summaryrefslogtreecommitdiff
path: root/rts/Capability.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2011-06-01 18:17:27 +0100
committerDuncan Coutts <duncan@well-typed.com>2011-07-18 16:31:13 +0100
commitededf355981fd08f52b4fab256f231179848073f (patch)
tree8e58b1f32cbee934de31f6012b19d5d55c6f08a1 /rts/Capability.c
parente0b98b42847dea19aff24df2faa354c9d414fc87 (diff)
downloadhaskell-ededf355981fd08f52b4fab256f231179848073f.tar.gz
Change tryStealSpark so it does not consume fizzled sparks
We want to count fizzled sparks accurately. Now tryStealSpark returns fizzled sparks, and the callers now update the fizzled spark count.
Diffstat (limited to 'rts/Capability.c')
-rw-r--r--rts/Capability.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index fe5dbdca40..a9bb743654 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -92,7 +92,11 @@ findSpark (Capability *cap)
// spark = reclaimSpark(cap->sparks);
// However, measurements show that this makes at least one benchmark
// slower (prsa) and doesn't affect the others.
- spark = tryStealSpark(cap);
+ spark = tryStealSpark(cap->sparks);
+ while (spark != NULL && fizzledSpark(spark)) {
+ cap->sparks_fizzled++;
+ spark = tryStealSpark(cap->sparks);
+ }
if (spark != NULL) {
cap->sparks_converted++;
@@ -121,7 +125,11 @@ findSpark (Capability *cap)
if (emptySparkPoolCap(robbed)) // nothing to steal here
continue;
- spark = tryStealSpark(robbed);
+ spark = tryStealSpark(robbed->sparks);
+ while (spark != NULL && fizzledSpark(spark)) {
+ cap->sparks_fizzled++;
+ spark = tryStealSpark(robbed->sparks);
+ }
if (spark == NULL && !emptySparkPoolCap(robbed)) {
// we conflicted with another thread while trying to steal;
// try again later.