[PATCH] D56333: [sanitizer] Reduce stack depot size on Android.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 14:29:46 PST 2019


eugenis created this revision.
eugenis added reviewers: kcc, pcc.
Herald added subscribers: kubamracek, srhines.

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.


https://reviews.llvm.org/D56333

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cc
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h


Index: compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
@@ -32,7 +32,7 @@
   void inc_use_count_unsafe();
 };
 
-const int kStackDepotMaxUseCount = 1U << 20;
+const int kStackDepotMaxUseCount = 1U << (SANITIZER_ANDROID ? 16 : 20);
 
 StackDepotStats *StackDepotGetStats();
 u32 StackDepotPut(StackTrace stack);
Index: compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cc
@@ -26,7 +26,7 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56333.180325.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190104/84bbce4d/attachment.bin>


More information about the llvm-commits mailing list