[compiler-rt] [scudo] increase frames per stack to 16 for stack depot (PR #82427)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 14:11:47 PST 2024


https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/82427

8 was very low and it is likely that in real workloads we have more than an average of 8 frames per stack given on Android we have 3 at the bottom: __start_main, __libc_init, main, and three at the top: malloc, scudo_malloc and Allocator::allocate. That leaves 2 frames for application code, which is clearly unreasonable.

>From 43399207eb43aead68c09c4795764d4580ab66dc Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Tue, 20 Feb 2024 14:10:38 -0800
Subject: [PATCH] [scudo] increase frames per stack to 16 for stack depot

8 was very low and it is likely that in real workloads we have more than
an average of 8 frames per stack given on Android we have 3 at the bottom:
__start_main, __libc_init, main, and three at the top: malloc,
scudo_malloc and Allocator::allocate. That leaves 2 frames for
application code, which is clearly unreasonable.
---
 compiler-rt/lib/scudo/standalone/combined.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 080ba42ad44497..24054ddac64337 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -1520,7 +1520,7 @@ class Allocator {
     constexpr u32 kStacksPerRingBufferEntry = 2;
     constexpr u32 kMaxU32Pow2 = ~(UINT32_MAX >> 1);
     static_assert(isPowerOfTwo(kMaxU32Pow2));
-    constexpr u32 kFramesPerStack = 8;
+    constexpr u32 kFramesPerStack = 16;
     static_assert(isPowerOfTwo(kFramesPerStack));
 
     // We need StackDepot to be aligned to 8-bytes so the ring we store after



More information about the llvm-commits mailing list