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

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 16:33:42 PDT 2024


================
@@ -408,15 +545,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() may fail spuriously, given that it should
----------------
cferris1000 wrote:

This comment is slightly hard to follow. Maybe something like:

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 page to be released.

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


More information about the llvm-commits mailing list