From 1612de197834e7d62c8bdabe3eeb492bb6c62400 Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy Date: Fri, 8 Nov 2024 12:50:50 +0300 Subject: [PATCH] arena: do not limit preallocated size to quota We are going to use arena in new mode. Preallocate large amount of memory beforehand and then grow quota as required. Preallocated memory is not mapped immediently anyway. Part of tarantool/tarantool#10429 --- small/slab_arena.c | 2 -- test/slab_arena.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/small/slab_arena.c b/small/slab_arena.c index 45ad9a1..4095f32 100644 --- a/small/slab_arena.c +++ b/small/slab_arena.c @@ -190,8 +190,6 @@ slab_arena_create(struct slab_arena *arena, struct quota *quota, arena->slab_size = small_round(MAX(slab_size, SLAB_MIN_SIZE)); arena->quota = quota; - /** Prealloc can not be greater than the quota */ - prealloc = MIN(prealloc, quota_total(quota)); /** Extremely large sizes can not be aligned properly */ prealloc = MIN(prealloc, SIZE_MAX - arena->slab_size); /* Align prealloc around a fixed number of slabs. */ diff --git a/test/slab_arena.c b/test/slab_arena.c index c96f109..a94150f 100644 --- a/test/slab_arena.c +++ b/test/slab_arena.c @@ -211,7 +211,7 @@ slab_test_basic(void) quota_init("a, 2000000); slab_arena_create(&arena, "a, 3000000, 1, MAP_PRIVATE); - ok_no_asan(arena.prealloc == 2031616); + ok_no_asan(arena.prealloc == 3014656); ok(quota_total("a) == 2000896); ok_no_asan(arena.used == 0); ok(arena.slab_size == SLAB_MIN_SIZE);