[compiler-rt] 6ddb25e - [scudo] increase frames per stack to 16 for stack depot (#82427)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 11:19:06 PST 2024
Author: Florian Mayer
Date: 2024-02-22T11:19:02-08:00
New Revision: 6ddb25ed9ca2cb0f4ad8f402d7411ac3328f598d
URL: https://github.com/llvm/llvm-project/commit/6ddb25ed9ca2cb0f4ad8f402d7411ac3328f598d
DIFF: https://github.com/llvm/llvm-project/commit/6ddb25ed9ca2cb0f4ad8f402d7411ac3328f598d.diff
LOG: [scudo] increase frames per stack to 16 for stack depot (#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.
Added:
Modified:
compiler-rt/lib/scudo/standalone/combined.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index f3c3d757c9f128..f13cf9498a7932 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -1522,7 +1522,12 @@ class Allocator {
constexpr u32 kStacksPerRingBufferEntry = 2;
constexpr u32 kMaxU32Pow2 = ~(UINT32_MAX >> 1);
static_assert(isPowerOfTwo(kMaxU32Pow2));
- constexpr u32 kFramesPerStack = 8;
+ // On Android we always have 3 frames at the bottom: __start_main,
+ // __libc_init, main, and 3 at the top: malloc, scudo_malloc and
+ // Allocator::allocate. This leaves 10 frames for the user app. The next
+ // smallest power of two (8) would only leave 2, which is clearly too
+ // little.
+ 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