[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
This commit is contained in:
Kostya Kortchinsky 2020-01-30 15:26:46 -08:00
parent abb0357123
commit 64cb77b946
3 changed files with 9 additions and 8 deletions

View File

@ -39,15 +39,16 @@ struct DefaultConfig {
struct AndroidConfig { struct AndroidConfig {
using SizeClassMap = AndroidSizeClassMap; using SizeClassMap = AndroidSizeClassMap;
#if SCUDO_CAN_USE_PRIMARY64 #if SCUDO_CAN_USE_PRIMARY64
// 128MB regions // 256MB regions
typedef SizeClassAllocator64<SizeClassMap, 27U, typedef SizeClassAllocator64<SizeClassMap, 28U,
/*MaySupportMemoryTagging=*/true> /*MaySupportMemoryTagging=*/true>
Primary; Primary;
#else #else
// 512KB regions // 256KB regions
typedef SizeClassAllocator32<SizeClassMap, 19U> Primary; typedef SizeClassAllocator32<SizeClassMap, 18U> Primary;
#endif #endif
typedef MapAllocator<MapAllocatorCache<>> Secondary; // Cache blocks up to 2MB
typedef MapAllocator<MapAllocatorCache<32U, 2UL << 20>> Secondary;
template <class A> template <class A>
using TSDRegistryT = TSDRegistrySharedT<A, 2U>; // Shared, max 2 TSDs. using TSDRegistryT = TSDRegistrySharedT<A, 2U>; // Shared, max 2 TSDs.
}; };

View File

@ -207,7 +207,7 @@ private:
static const uptr PrimarySize = RegionSize * NumClasses; static const uptr PrimarySize = RegionSize * NumClasses;
// Call map for user memory with at least this size. // 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. // Fill at most this number of batches from the newly map'd memory.
static const u32 MaxNumBatches = 8U; static const u32 MaxNumBatches = 8U;

View File

@ -141,10 +141,10 @@ typedef SizeClassMap<3, 5, 8, 17, 8, 10> DefaultSizeClassMap;
// TODO(kostyak): further tune class maps for Android & Fuchsia. // TODO(kostyak): further tune class maps for Android & Fuchsia.
#if SCUDO_WORDSIZE == 64U #if SCUDO_WORDSIZE == 64U
typedef SizeClassMap<4, 4, 8, 14, 4, 10> SvelteSizeClassMap; 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 #else
typedef SizeClassMap<4, 3, 7, 14, 5, 10> SvelteSizeClassMap; 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 #endif
} // namespace scudo } // namespace scudo