[PATCH] D42194: [scudo] Limit by default the TSD pool to 2 on Android

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 12:25:06 PST 2018


cryptoad created this revision.
cryptoad added a reviewer: alekseyshl.
Herald added subscribers: Sanitizers, srhines.

jemalloc on Android currently uses 2 arenas
(https://android.googlesource.com/platform/external/jemalloc/+/master/Android.bp#64).
Since the Android toolchain absorbs compiler-rt and compiles it as is, we have
to enforce the same limit to somehow stay competitive in terms of memory usage.

The changes could either go in:

- `scudo_platform.h` with a default for Android of 2 (this is the solution implemented here);
- in `CMakeLists.txt` adding -DSCUDO_SHARED_TSD_POOL_SIZE=2 for Android.
- something else?

I don't have a strong opinion on how to do it, but it has to be done upstream
anyway.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42194

Files:
  lib/scudo/scudo_platform.h


Index: lib/scudo/scudo_platform.h
===================================================================
--- lib/scudo/scudo_platform.h
+++ lib/scudo/scudo_platform.h
@@ -43,7 +43,11 @@
 
 // Maximum number of TSDs that can be created for the Shared model.
 #ifndef SCUDO_SHARED_TSD_POOL_SIZE
-# define SCUDO_SHARED_TSD_POOL_SIZE 32U
+# if SANITIZER_ANDROID
+#  define SCUDO_SHARED_TSD_POOL_SIZE 2U
+# else
+#  define SCUDO_SHARED_TSD_POOL_SIZE 32U
+# endif  // SANITIZER_ANDROID
 #endif  // SCUDO_SHARED_TSD_POOL_SIZE
 
 // The following allows the public interface functions to be disabled.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42194.130248.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180117/7577d1be/attachment.bin>


More information about the llvm-commits mailing list