diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-03-13 10:45:16 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-03-13 10:45:16 +0000 |
commit | 304e7fb703e7afddc1ef9be6aab6505e36b63b06 (patch) | |
tree | 578332aa77e0c1c2d176218d23ae0beb0afd98af /rts/Interpreter.c | |
parent | c197fe602ed4aadf09affe0cdc18e7158d262012 (diff) | |
download | haskell-304e7fb703e7afddc1ef9be6aab6505e36b63b06.tar.gz |
Instead of a separate context-switch flag, set HpLim to zero
This reduces the latency between a context-switch being triggered and
the thread returning to the scheduler, which in turn should reduce the
cost of the GC barrier when there are many cores.
We still retain the old context_switch flag which is checked at the
end of each block of allocation. The idea is that setting HpLim may
fail if the the target thread is modifying HpLim at the same time; the
context_switch flag is a fallback. It also allows us to "context
switch soon" without forcing an immediate switch, which can be costly.
Diffstat (limited to 'rts/Interpreter.c')
-rw-r--r-- | rts/Interpreter.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c index 1b2d7303ed..1a6e9273e0 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -196,6 +196,9 @@ interpretBCO (Capability* cap) LOAD_STACK_POINTERS; + cap->r.rHpLim = (P_)1; // HpLim is the context-switch flag; when it + // goes to zero we must return to the scheduler. + // ------------------------------------------------------------------------ // Case 1: // @@ -1281,7 +1284,7 @@ run_BCO: // context switching: sometimes the scheduler can invoke // the interpreter with context_switch == 1, particularly // if the -C0 flag has been given on the cmd line. - if (cap->context_switch) { + if (cap->r.rHpLim == NULL) { Sp--; Sp[0] = (W_)&stg_enter_info; RETURN_TO_SCHEDULER(ThreadInterpret, ThreadYielding); } |