summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-03-23 22:37:11 -0400
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-04-04 18:26:48 +0200
commit9d7596d0413a12748232a6ef69d5cbad2260746b (patch)
treec95fa79fef4f0fe8bdae0d157d8d944b59e49e42
parenta8e36892689bd6b8fb472844f79aeeddeda92e0a (diff)
downloadhaskell-wip/T23170.tar.gz
nonmoving: Disable slop-zeroingwip/T23170
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
-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;