diff --git a/core/hakmem_mid_mt.h b/core/hakmem_mid_mt.h index 3570eea8..281d2fa5 100644 --- a/core/hakmem_mid_mt.h +++ b/core/hakmem_mid_mt.h @@ -1,13 +1,13 @@ /** * hakmem_mid_mt.h * - * Mid Range Multi-threaded Allocator (8-32KB) + * Mid Range Multi-threaded Allocator (1-32KB) * mimalloc-style per-thread segment design for optimal MT performance * * Part of Hybrid Approach: - * - ≤1KB: Tiny Pool (static optimization, P0 complete) - * - 8-32KB: Mid MT (this module, mimalloc-style per-thread) - * - ≥64KB: Large Pool (learning-based, ELO strategies) + * - ≤1023B: Tiny Pool (header-based, C7 usable size) + * - 1-32KB: Mid MT (this module, mimalloc-style per-thread) + * - ≥64KB: Large Pool (learning-based, ELO strategies) * * Created: 2025-11-01 * Goal: 46M → 100-120M ops/s (2.2-2.6x improvement) @@ -34,7 +34,11 @@ extern "C" { #define MID_SIZE_CLASS_32K 2 // 32KB blocks #define MID_NUM_CLASSES 3 // Total number of size classes -#define MID_MIN_SIZE (8 * 1024) // 8KB +// Phase 13: Close Tiny/Mid gap. +// Tiny now handles up to 1023B (C7 usable size), so Mid must accept +// 1KB-32KB. We keep size classes at 8/16/32KB; sub-8KB sizes use the +// 8KB class with some internal slack. +#define MID_MIN_SIZE (1024) // 1KB (was 8KB) #define MID_MAX_SIZE (32 * 1024) // 32KB #define MID_CHUNK_SIZE (4 * 1024 * 1024) // 4MB chunks (same as mimalloc segments) diff --git a/core/hakmem_tiny.h b/core/hakmem_tiny.h index adfe0277..f9be4351 100644 --- a/core/hakmem_tiny.h +++ b/core/hakmem_tiny.h @@ -23,7 +23,9 @@ int hak_is_initializing(void); #define TINY_NUM_CLASSES 8 #define TINY_SLAB_SIZE (64 * 1024) // 64KB per slab -#define TINY_MAX_SIZE 1024 // Tiny handles up to 1024B (C7 headerless) +// Phase E1-CORRECT: All Tiny classes use a 1-byte header. +// C7 stride=1024B → usable 1023B (1024-1). 1024B は Mid allocator に委譲する。 +#define TINY_MAX_SIZE 1023 // Tiny handles up to 1023B (C7 usable size) // ============================================================================ // Size Classes