diff --git a/core/hakmem_policy.c b/core/hakmem_policy.c index 7917cd93..3224e088 100644 --- a/core/hakmem_policy.c +++ b/core/hakmem_policy.c @@ -15,10 +15,18 @@ void hkm_policy_init(void) { pol->tiny_cap[1] = 1024; pol->tiny_cap[2] = 768; pol->tiny_cap[3] = 512; - pol->tiny_cap[4] = 256; - pol->tiny_cap[5] = 256; - pol->tiny_cap[6] = 128; - pol->tiny_cap[7] = 64; + pol->tiny_cap[4] = 512; // Loosened from 256 for Shared Pool + pol->tiny_cap[5] = 512; // Loosened from 256 + pol->tiny_cap[6] = 256; // Loosened from 128 + pol->tiny_cap[7] = 256; // C7 soft cap: Keep at 256 to force legacy fallback (legacy is 45x faster: 47M vs 1M ops/s) + // Tiny min-keep (per class Superslab reserve). + // C2-C6: Keep a few slabs to reduce mmap/munmap churn in mixed workloads. + for (int i = 0; i < 8; i++) pol->tiny_min_keep[i] = 0; + pol->tiny_min_keep[2] = 2; // 32B + pol->tiny_min_keep[3] = 2; // 64B + pol->tiny_min_keep[4] = 2; // 128B + pol->tiny_min_keep[5] = 1; // 256B + pol->tiny_min_keep[6] = 1; // 512B // ======================================================================== // CAP初期値の設計思想: diff --git a/core/hakmem_policy.h b/core/hakmem_policy.h index 45bbd4ea..a32fe35d 100644 --- a/core/hakmem_policy.h +++ b/core/hakmem_policy.h @@ -13,7 +13,8 @@ // SACS-3: Only L1 (ACE layer) fields are consulted on the hot path. typedef struct FrozenPolicy { // Tiny (L0) – reserved for future CAP tuning (not used by hot path yet) - uint16_t tiny_cap[8]; // classes 0..7 + uint16_t tiny_cap[8]; // classes 0..7 + uint16_t tiny_min_keep[8]; // min slabs to keep (reduce mmap/munmap churn) // L1 ACE – MidPool (2–32KiB) and LargePool (64KiB–1MiB) uint16_t mid_cap[5]; // 2/4/8/16/32 KiB