[compiler-rt] Reapply "[scudo] Apply the min release threshold to the group" (#112252) (PR #112266)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 14:29:34 PDT 2024


https://github.com/ChiaHungDuan created https://github.com/llvm/llvm-project/pull/112266

This reverts commit 037938d637b830332e50232d7b90b5faad039c11.

Fixed the iterator to avoid infinite loop

>From 59e304237793505b8c28252cdbc550d449b8fb59 Mon Sep 17 00:00:00 2001
From: Chia-hung Duan <chiahungduan at google.com>
Date: Mon, 14 Oct 2024 21:28:01 +0000
Subject: [PATCH] Reapply "[scudo] Apply the min release threshold to the
 group" (#112252)

This reverts commit 037938d637b830332e50232d7b90b5faad039c11.
---
 compiler-rt/lib/scudo/standalone/primary64.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 97188a5ac235cc..e382e01f5d8e54 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1492,6 +1492,11 @@ template <typename Config> class SizeClassAllocator64 {
       }
 
       const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
+      if (PushedBytesDelta < getMinReleaseAttemptSize(BlockSize)) {
+        Prev = BG;
+        BG = BG->Next;
+        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