summaryrefslogtreecommitdiff
path: root/rts/Messages.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-12-01 10:53:28 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-12-01 11:29:53 +0000
commit6d18141d880d55958c3392f6a7ae621dc33ee5c1 (patch)
treeedd5607a50a92ffad4707cef792a06246b5b41e4 /rts/Messages.c
parent1d012e31577951ff5fe74d0277fabdb08c27929d (diff)
downloadhaskell-6d18141d880d55958c3392f6a7ae621dc33ee5c1.tar.gz
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.
Diffstat (limited to 'rts/Messages.c')
-rw-r--r--rts/Messages.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Messages.c b/rts/Messages.c
index 5dec6c6927..6cb66479ee 100644
--- a/rts/Messages.c
+++ b/rts/Messages.c
@@ -46,9 +46,9 @@ void sendMessage(Capability *from_cap, Capability *to_cap, Message *msg)
if (to_cap->running_task == NULL) {
to_cap->running_task = myTask();
// precond for releaseCapability_()
- releaseCapability_(to_cap,rtsFalse);
+ releaseCapability_(to_cap,rtsFalse);
} else {
- contextSwitchCapability(to_cap);
+ interruptCapability(to_cap);
}
RELEASE_LOCK(&to_cap->lock);