[compiler-rt] r350443 - [sanitizer] Reduce stack depot size on Android.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 14:55:04 PST 2019


Author: eugenis
Date: Fri Jan  4 14:55:04 2019
New Revision: 350443

URL: http://llvm.org/viewvc/llvm-project?rev=350443&view=rev
Log:
[sanitizer] Reduce stack depot size on Android.

Summary:
The default setting kTabSizeLog=20 results in an 8Mb global hash table,
almost all of it in private pages. That is not a sane setting in a
mobile, system-wide use case: with ~150 concurrent processes stack
depot will account for more than 1Gb of RAM.

Reviewers: kcc, pcc

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D56333

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.cc?rev=350443&r1=350442&r2=350443&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.cc Fri Jan  4 14:55:04 2019
@@ -26,7 +26,7 @@ struct StackDepotNode {
   u32 tag;
   uptr stack[1];  // [size]
 
-  static const u32 kTabSizeLog = 20;
+  static const u32 kTabSizeLog = SANITIZER_ANDROID ? 16 : 20;
   // Lower kTabSizeLog bits are equal for all items in one bucket.
   // We use these bits to store the per-stack use counter.
   static const u32 kUseCountBits = kTabSizeLog;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h?rev=350443&r1=350442&r2=350443&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h Fri Jan  4 14:55:04 2019
@@ -32,7 +32,7 @@ struct StackDepotHandle {
   void inc_use_count_unsafe();
 };
 
-const int kStackDepotMaxUseCount = 1U << 20;
+const int kStackDepotMaxUseCount = 1U << (SANITIZER_ANDROID ? 16 : 20);
 
 StackDepotStats *StackDepotGetStats();
 u32 StackDepotPut(StackTrace stack);




More information about the llvm-commits mailing list