[compiler-rt] 64cb77b - [scudo][standalone] Change default Android config
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 14:46:53 PST 2020
Author: Kostya Kortchinsky
Date: 2020-01-31T14:46:35-08:00
New Revision: 64cb77b9469207799e570483dadc720dbf12c794
URL: https://github.com/llvm/llvm-project/commit/64cb77b9469207799e570483dadc720dbf12c794
DIFF: https://github.com/llvm/llvm-project/commit/64cb77b9469207799e570483dadc720dbf12c794.diff
LOG: [scudo][standalone] Change default Android config
Summary:
This changes a couple of parameters in the default Android config to
address some performance and memory footprint issues (well to be closer
to the default Bionic allocator numbers).
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D73750
Added:
Modified:
compiler-rt/lib/scudo/standalone/allocator_config.h
compiler-rt/lib/scudo/standalone/primary64.h
compiler-rt/lib/scudo/standalone/size_class_map.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/allocator_config.h b/compiler-rt/lib/scudo/standalone/allocator_config.h
index 890c9f0a1f97..3d338501ae4a 100644
--- a/compiler-rt/lib/scudo/standalone/allocator_config.h
+++ b/compiler-rt/lib/scudo/standalone/allocator_config.h
@@ -39,15 +39,16 @@ struct DefaultConfig {
struct AndroidConfig {
using SizeClassMap = AndroidSizeClassMap;
#if SCUDO_CAN_USE_PRIMARY64
- // 128MB regions
- typedef SizeClassAllocator64<SizeClassMap, 27U,
+ // 256MB regions
+ typedef SizeClassAllocator64<SizeClassMap, 28U,
/*MaySupportMemoryTagging=*/true>
Primary;
#else
- // 512KB regions
- typedef SizeClassAllocator32<SizeClassMap, 19U> Primary;
+ // 256KB regions
+ typedef SizeClassAllocator32<SizeClassMap, 18U> Primary;
#endif
- typedef MapAllocator<MapAllocatorCache<>> Secondary;
+ // Cache blocks up to 2MB
+ typedef MapAllocator<MapAllocatorCache<32U, 2UL << 20>> Secondary;
template <class A>
using TSDRegistryT = TSDRegistrySharedT<A, 2U>; // Shared, max 2 TSDs.
};
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 02e8051d330f..9d8dcac6562a 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -207,7 +207,7 @@ class SizeClassAllocator64 {
static const uptr PrimarySize = RegionSize * NumClasses;
// Call map for user memory with at least this size.
- static const uptr MapSizeIncrement = 1UL << 17;
+ static const uptr MapSizeIncrement = 1UL << 18;
// Fill at most this number of batches from the newly map'd memory.
static const u32 MaxNumBatches = 8U;
diff --git a/compiler-rt/lib/scudo/standalone/size_class_map.h b/compiler-rt/lib/scudo/standalone/size_class_map.h
index 947526e8aea1..f16fed73833f 100644
--- a/compiler-rt/lib/scudo/standalone/size_class_map.h
+++ b/compiler-rt/lib/scudo/standalone/size_class_map.h
@@ -141,10 +141,10 @@ typedef SizeClassMap<3, 5, 8, 17, 8, 10> DefaultSizeClassMap;
// TODO(kostyak): further tune class maps for Android & Fuchsia.
#if SCUDO_WORDSIZE == 64U
typedef SizeClassMap<4, 4, 8, 14, 4, 10> SvelteSizeClassMap;
-typedef SizeClassMap<3, 5, 8, 17, 14, 14> AndroidSizeClassMap;
+typedef SizeClassMap<2, 5, 9, 16, 14, 14> AndroidSizeClassMap;
#else
typedef SizeClassMap<4, 3, 7, 14, 5, 10> SvelteSizeClassMap;
-typedef SizeClassMap<3, 5, 8, 17, 14, 14> AndroidSizeClassMap;
+typedef SizeClassMap<2, 5, 9, 16, 14, 14> AndroidSizeClassMap;
#endif
} // namespace scudo
More information about the llvm-commits
mailing list