[compiler-rt] [scudo] Reduce thread contention in secondary cache releases. (PR #102984)

Joshua Baehring via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 17:50:44 PDT 2024


================
@@ -351,9 +351,13 @@ class MapAllocatorCache {
     for (MemMapT &EvictMemMap : EvictionMemMaps)
       unmapCallBack(EvictMemMap);
 
-    if (Interval >= 0) {
+    // If a thread already holds the mutex, the current thread can
----------------
JoshuaMBa wrote:

Right, I misunderstood why this was originally added, but I believe that in the case that many retrieves are happening and blocking the acquisition of the lock, we decided it was okay to skip the release to avoid releasing memory right before it was retrieved anyway. I will update the comment accordingly.

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


More information about the llvm-commits mailing list