[compiler-rt] 53c9553 - [scudo] Apply the min release threshold to the group (#112014)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 10:46:16 PDT 2024


Author: ChiaHungDuan
Date: 2024-10-14T10:46:12-07:00
New Revision: 53c9553562c778338a82574123fb7cfb943c4042

URL: https://github.com/llvm/llvm-project/commit/53c9553562c778338a82574123fb7cfb943c4042
DIFF: https://github.com/llvm/llvm-project/commit/53c9553562c778338a82574123fb7cfb943c4042.diff

LOG: [scudo] Apply the min release threshold to the group (#112014)

For the block smaller than a page size, one block is unlikely to
introduce more unused pages (at most 2 if it acrosses the page boundary
and both touched pages are unused). So it's better to apply the
threshold to reduce the time of scanning groups that can't release any
new pages.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/primary64.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 97188a5ac235cc..1865ed41368e3c 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1492,6 +1492,8 @@ template <typename Config> class SizeClassAllocator64 {
       }
 
       const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
+      if (PushedBytesDelta < getMinReleaseAttemptSize(BlockSize))
+        continue;
 
       // Given the randomness property, we try to release the pages only if the
       // bytes used by free blocks exceed certain proportion of group size. Note


        


More information about the llvm-commits mailing list