From 86b0b3e452dedad7357e32827494e271ffb465a9 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 21 Mar 2021 18:09:02 -0400 Subject: [PATCH] fix !CONFIG_EXTENDED_SIZE_CLASSES configuration --- h_malloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/h_malloc.c b/h_malloc.c index 23d4392..3d13278 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -101,13 +101,16 @@ struct slab_metadata { static const size_t min_align = 16; #define MIN_SLAB_SIZE_CLASS_SHIFT 4 -// set slab cache size based on the size of the largest slab #if !CONFIG_EXTENDED_SIZE_CLASSES -static const size_t MAX_SLAB_SIZE_CLASS = 65536; +static const size_t MAX_SLAB_SIZE_CLASS = 16384; #define MAX_SLAB_SIZE_CLASS_SHIFT 14 +// limit on the number of cached empty slabs before attempting purging instead +static const size_t max_empty_slabs_total = MAX_SLAB_SIZE_CLASS * 4; #else static const size_t MAX_SLAB_SIZE_CLASS = 131072; #define MAX_SLAB_SIZE_CLASS_SHIFT 17 +// limit on the number of cached empty slabs before attempting purging instead +static const size_t max_empty_slabs_total = MAX_SLAB_SIZE_CLASS; #endif static const u32 size_classes[] = { @@ -204,9 +207,6 @@ static size_t get_slab_size(size_t slots, size_t size) { return PAGE_CEILING(slots * size); } -// limit on the number of cached empty slabs before attempting purging instead -static const size_t max_empty_slabs_total = MAX_SLAB_SIZE_CLASS; - struct __attribute__((aligned(CACHELINE_SIZE))) size_class { struct mutex lock;