From ae35d1fd3715c08eb076a61eeeb5606b6961a243 Mon Sep 17 00:00:00 2001 From: Chia-hung Duan Date: Fri, 11 Oct 2024 16:02:12 +0000 Subject: [PATCH] [scudo] Apply the min release threshold to the group 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. --- compiler-rt/lib/scudo/standalone/primary64.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h index 97188a5ac235c..1865ed41368e3 100644 --- a/compiler-rt/lib/scudo/standalone/primary64.h +++ b/compiler-rt/lib/scudo/standalone/primary64.h @@ -1492,6 +1492,8 @@ template 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