From ee4d7b7f9a5c1b48d462be2b65c16e4ead8e3396 Mon Sep 17 00:00:00 2001 From: guangli-dai Date: Tue, 28 Apr 2026 22:10:27 -0700 Subject: [PATCH] Update a0's oversize threshold regardless whether huge arena is enabled or not. --- src/arena.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/arena.c b/src/arena.c index e43aabe4..98385460 100644 --- a/src/arena.c +++ b/src/arena.c @@ -1954,9 +1954,6 @@ arena_init_huge(tsdn_t *tsdn, arena_t *a0) { huge_arena_ind = narenas_total_get(); assert(huge_arena_ind != 0); oversize_threshold = opt_oversize_threshold; - /* a0 init happened before malloc_conf_init. */ - atomic_store_zu(&a0->pa_shard.pac.oversize_threshold, - oversize_threshold, ATOMIC_RELAXED); /* Initialize huge_arena_pac_thp fields. */ base_t *b0 = a0->base; /* Make sure that b0 thp auto-switch won't happen concurrently here. */ @@ -1974,6 +1971,10 @@ arena_init_huge(tsdn_t *tsdn, arena_t *a0) { huge_enabled = true; } + /* a0 init happened before malloc_conf_init. */ + atomic_store_zu(&a0->pa_shard.pac.oversize_threshold, + oversize_threshold, ATOMIC_RELAXED); + return huge_enabled; }