diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-11-06 11:36:39 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-11-06 11:36:39 +0000 |
commit | 2b16fa4791b08b02df8461f3b79d0e44d72d0960 (patch) | |
tree | 53d0bba9254703d7d569e91c0f0f7b19ba8f25f8 /rts/Sparks.c | |
parent | ebfa6fde6d9797ad2434a2af73a4c85b2984e00a (diff) | |
download | haskell-2b16fa4791b08b02df8461f3b79d0e44d72d0960.tar.gz |
Run sparks in batches, instead of creating a new thread for each one
Signficantly reduces the overhead for par, which means that we can
make use of paralellism at a much finer granularity.
Diffstat (limited to 'rts/Sparks.c')
-rw-r--r-- | rts/Sparks.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c index 38a3090611..e7273f3ed0 100644 --- a/rts/Sparks.c +++ b/rts/Sparks.c @@ -44,6 +44,7 @@ #include "RtsUtils.h" #include "ParTicky.h" #include "Trace.h" +#include "Prelude.h" #include "SMP.h" // for cas @@ -227,8 +228,9 @@ steal(SparkPool *deque) } StgClosure * -tryStealSpark (SparkPool *pool) +tryStealSpark (Capability *cap) { + SparkPool *pool = cap->sparks; StgClosure *stolen; do { @@ -264,13 +266,13 @@ looksEmpty(SparkPool* deque) * -------------------------------------------------------------------------- */ void -createSparkThread (Capability *cap, StgClosure *p) +createSparkThread (Capability *cap) { StgTSO *tso; - tso = createGenThread (cap, RtsFlags.GcFlags.initialStkSize, p); + tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize, + &base_GHCziConc_runSparks_closure); appendToRunQueue(cap,tso); - cap->sparks_converted++; } /* ----------------------------------------------------------------------------- |