[Git][ghc/ghc][wip/T23170] nonmoving: Disable slop-zeroing

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Fri Mar 24 12:28:16 UTC 2023



Ben Gamari pushed to branch wip/T23170 at Glasgow Haskell Compiler / GHC


Commits:
a3c8bb7a by Ben Gamari at 2023-03-24T08:28:09-04:00
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

- - - - -


1 changed file:

- rts/include/rts/storage/ClosureMacros.h


Changes:

=====================================
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;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3c8bb7a904660ab97f3d09c38077d89be472301

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3c8bb7a904660ab97f3d09c38077d89be472301
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230324/fc20d1c0/attachment-0001.html>


More information about the ghc-commits mailing list