[commit: ghc] master: Fix a scheduling bug in the threaded RTS (6d18141)
Simon Marlow
marlowsd at gmail.com
Thu Dec 1 14:03:42 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/6d18141d880d55958c3392f6a7ae621dc33ee5c1
>---------------------------------------------------------------
commit 6d18141d880d55958c3392f6a7ae621dc33ee5c1
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Dec 1 10:53:28 2011 +0000
Fix a scheduling bug in the threaded RTS
The parallel GC was using setContextSwitches() to stop all the other
threads, which sets the context_switch flag on every Capability. That
had the side effect of causing every Capability to also switch
threads, and since GCs can be much more frequent than context
switches, this increased the context switch frequency. When context
switches are expensive (because the switch is between two bound
threads or a bound and unbound thread), the difference is quite
noticeable.
The fix is to have a separate flag to indicate that a Capability
should stop and return to the scheduler, but not switch threads. I've
called this the "interrupt" flag.
includes/mkDerivedConstants.c | 1 +
rts/Capability.c | 10 ++++++++-
rts/Capability.h | 46 +++++++++++++++++++++++++++++++++--------
rts/HeapStackCheck.cmm | 3 +-
rts/Messages.c | 4 +-
rts/Schedule.c | 18 ++++++++++-----
rts/Timer.c | 2 +-
rts/sm/GC.c | 2 +-
8 files changed, 65 insertions(+), 21 deletions(-)
Diff suppressed because of size. To see it, use:
git show 6d18141d880d55958c3392f6a7ae621dc33ee5c1
More information about the Cvs-ghc
mailing list