Skip to content
  • Sergei Trofimovich's avatar
    GhcMake: limit Capability count to CPU count in parallel mode · 9d175605
    Sergei Trofimovich authored
    
    
    In Trac #9221 one of problems using high --jobs=<N>
    is amount of mutator (or GC) threads we crate.
    
    We use userspace spinning-and-yielding (see ACQUIRE_SPIN_LOCK)
    to acess work stealing queues. In case of
    N-worker-threads > N-CPUs fraction of time when
    thread holding spin lock gets descheduled by kernel
    increases. That causes other threads to waste CPU time
    before giving up CPU.
    
    Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
    
    Test Plan:
    ghc --make -j8 and -j80 have comparable sys time
    on a 8-core system.
    
    Reviewers: austin, gintas, bgamari, simonmar
    
    Reviewed By: bgamari, simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2482
    
    GHC Trac Issues: #9221
    9d175605