patch applied (ghc): When acquiring a spinlock, yieldThread() every 1000 spins (#3553, #3758)

Simon Marlow simonmar at galois.com
Mon Jan 25 06:54:26 EST 2010


Fri Jan 22 08:49:11 PST 2010  Simon Marlow <marlowsd at gmail.com>
  * When acquiring a spinlock, yieldThread() every 1000 spins (#3553, #3758)
  
  This helps when the thread holding the lock has been descheduled,
  which is the main cause of the "last-core slowdown" problem.  With
  this patch, I get much better results with -N8 on an 8-core box,
  although some benchmarks are still worse than with 7 cores.
  
  I also added a yieldThread() into the any_work() loop of the parallel
  GC when it has no work to do. Oddly, this seems to improve performance
  on the parallel GC benchmarks even when all the cores are busy.
  Perhaps it is due to reducing contention on the memory bus.

    M ./includes/rts/Constants.h +9
    M ./includes/rts/SpinLock.h -11 +18
    M ./includes/rts/storage/SMPClosureOps.h -2
    M ./rts/sm/GC.c +3

View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20100122164911-12142-a282afbeaf76540ffedfbd8484d94afe7cf58ad6.gz



More information about the Cvs-ghc mailing list