From d1b9d679459bcdca064d3049cc76db50c625b1a1 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 1 Jan 2021 21:03:21 -0500 Subject: rts/Capability: Use relaxed load in findSpark When checking n_returning_tasks. --- rts/Capability.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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. -- cgit v1.2.1