[compiler-rt] [scudo] Add EnableMultiRegions mode (PR #98076)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 17:40:07 PST 2024


================
@@ -408,15 +544,20 @@ template <typename Config> class SizeClassAllocator64 {
   }
 
   uptr tryReleaseToOS(uptr ClassId, ReleaseToOS ReleaseType) {
-    RegionInfo *Region = getRegionInfo(ClassId);
-    // Note that the tryLock() may fail spuriously, given that it should rarely
-    // happen and page releasing is fine to skip, we don't take certain
-    // approaches to ensure one page release is done.
-    if (Region->MMLock.tryLock()) {
-      uptr BytesReleased = releaseToOSMaybe(Region, ClassId, ReleaseType);
-      Region->MMLock.unlock();
-      return BytesReleased;
-    }
+    auto RegionInfoIter = RegionInfoManager.getRegionInfoIter(ClassId);
+
+    do {
+      // Note that the tryLock() can fail under certain circumstances. Since
+      // this should be a rare occurrence, there is no need to do anything to
+      // force at least one `releaseToOSMaybe()` is called().
----------------
cferris1000 wrote:

This is slightly awkward. Hope about something like:

force at least one call to `releaseToOSMaybe()`.

https://github.com/llvm/llvm-project/pull/98076


More information about the llvm-commits mailing list