summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-03-23 22:37:11 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-06 03:40:45 -0400
commitd1bb16ed3e18a4f41fcfe31f0bf57dbaf589d6c5 (patch)
treec21b3fa1de34484ed39d55d4084e73fe7f23ecef /rts
parentc165f079a13232a44689c55a61c70e2c9aea5464 (diff)
downloadhaskell-d1bb16ed3e18a4f41fcfe31f0bf57dbaf589d6c5.tar.gz
nonmoving: Disable slop-zeroing
As noted in #23170, the nonmoving GC can race with a mutator zeroing the slop of an updated thunk (in much the same way that two mutators would race). Consequently, we must disable slop-zeroing when the nonmoving GC is in use. Closes #23170
Diffstat (limited to 'rts')
-rw-r--r--rts/include/rts/storage/ClosureMacros.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/rts/include/rts/storage/ClosureMacros.h b/rts/include/rts/storage/ClosureMacros.h
index af4d13a198..57e9be2de8 100644
--- a/rts/include/rts/storage/ClosureMacros.h
+++ b/rts/include/rts/storage/ClosureMacros.h
@@ -479,11 +479,13 @@ EXTERN_INLINE StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
memory we're about to zero.
Thus, with the THREADED RTS and +RTS -N2 or greater we must not zero
- immutable closure's slop.
+ immutable closure's slop. Similarly, the concurrent GC's mark thread
+ may race when a mutator during slop-zeroing. Consequently, we also disable
+ zeroing when the non-moving GC is in use.
Hence, an immutable closure's slop is zeroed when either:
- - PROFILING && era > 0 (LDV is on) or
+ - PROFILING && era > 0 (LDV is on) && !nonmoving-gc-enabled or
- !THREADED && DEBUG
Additionally:
@@ -535,8 +537,10 @@ zeroSlop (StgClosure *p,
#endif
;
- // Only if we're running single threaded.
- const bool can_zero_immutable_slop = getNumCapabilities() == 1;
+ const bool can_zero_immutable_slop =
+ // Only if we're running single threaded.
+ getNumCapabilities() == 1
+ && !RTS_DEREF(RtsFlags).GcFlags.useNonmoving; // see #23170
const bool zero_slop_immutable =
want_to_zero_immutable_slop && can_zero_immutable_slop;