summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-01-01 21:03:21 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-09 21:21:38 -0500
commitd1b9d679459bcdca064d3049cc76db50c625b1a1 (patch)
treef6ee30b92f5e32b238b08df3caaff1f3f0d24e87
parent83ac5594d101440f72dc0ead97f0d1583056c07d (diff)
downloadhaskell-d1b9d679459bcdca064d3049cc76db50c625b1a1.tar.gz
rts/Capability: Use relaxed load in findSpark
When checking n_returning_tasks.
-rw-r--r--rts/Capability.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index dd24ce6681..c30135d695 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -99,7 +99,8 @@ findSpark (Capability *cap)
bool retry;
uint32_t i = 0;
- if (!emptyRunQueue(cap) || cap->n_returning_tasks != 0) {
+ // This is an approximate check so relaxed load is acceptable here.
+ if (!emptyRunQueue(cap) || RELAXED_LOAD(&cap->n_returning_tasks) != 0) {
// If there are other threads, don't try to run any new
// sparks: sparks might be speculative, we don't want to take
// resources away from the main computation.