diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-03-23 22:37:11 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-05-16 07:56:09 -0400 |
commit | 5637364e2c4f583e4457041b701da4f10202d193 (patch) | |
tree | 0bb5bd7bfcab4f23bb803151acbf0d9412b2c2ae | |
parent | 6cd0f8079525fac92bbd6e0c1dbabc3180f8887b (diff) | |
download | haskell-5637364e2c4f583e4457041b701da4f10202d193.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
(cherry picked from commit d1bb16ed3e18a4f41fcfe31f0bf57dbaf589d6c5)
-rw-r--r-- | rts/include/rts/storage/ClosureMacros.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rts/include/rts/storage/ClosureMacros.h b/rts/include/rts/storage/ClosureMacros.h index ecfca8a81c..f250c994d9 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: @@ -541,7 +543,8 @@ zeroSlop (StgClosure *p, uint32_t offset, uint32_t size, bool known_mutable) const bool can_zero_immutable_slop = // Only if we're running single threaded. - RTS_DEREF(RtsFlags).ParFlags.nCapabilities <= 1; + RTS_DEREF(RtsFlags).ParFlags.nCapabilities <= 1 + && !RTS_DEREF(RtsFlags).GcFlags.useNonmoving; // see #23170 const bool zero_slop_immutable = want_to_zero_immutable_slop && can_zero_immutable_slop; |