[Git][ghc/ghc][master] nonmoving: Disable slop-zeroing

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Apr 6 07:41:02 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d1bb16ed by Ben Gamari at 2023-04-06T03:40:45-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:
@@ -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;



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d1bb16ed3e18a4f41fcfe31f0bf57dbaf589d6c5
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/20230406/a14723c2/attachment-0001.html>


More information about the ghc-commits mailing list