Moe Charm (CI)
7311d32574
Phase 24 PageArena/HotSpanBox: Mid/VM page reuse cache (structural limit identified)
Summary:
- Implemented PageArena (Box PA1-PA3) for Mid-Large (8-52KB) / L25 (64KB-2MB)
- Integration: Pool TLS Arena + L25 alloc/refill paths
- Result: Minimal impact (+4.7% Mid, 0% VM page-fault reduction)
- Conclusion: Structural limit - existing Arena/Pool/L25 already optimized
Implementation:
1. Box PA1: Hot Page Cache (4KB pages, LIFO stack, 1024 slots)
- core/page_arena.c: hot_page_alloc/free with mutex protection
- TLS cache for 4KB pages
2. Box PA2: Warm Span Cache (64KB-2MB spans, size-bucketed)
- 64KB/128KB/2MB span caches (256/128/64 slots)
- Size-class based allocation
3. Box PA3: Cold Path (mmap fallback)
- page_arena_alloc_pages/aligned with fallback to direct mmap
Integration Points:
4. Pool TLS Arena (core/pool_tls_arena.c)
- chunk_ensure(): Lazy init + page_arena_alloc_pages() hook
- arena_cleanup_thread(): Return chunks to PageArena if enabled
- Exponential growth preserved (1MB → 8MB)
5. L25 Pool (core/hakmem_l25_pool.c)
- l25_alloc_new_run(): Lazy init + page_arena_alloc_aligned() hook
- refill_freelist(): PageArena allocation for bundles
- 2MB run carving preserved
ENV Variables:
- HAKMEM_PAGE_ARENA_ENABLE=1 (default: 0, OFF)
- HAKMEM_PAGE_ARENA_HOT_SIZE=1024 (default: 1024)
- HAKMEM_PAGE_ARENA_WARM_64K=256 (default: 256)
- HAKMEM_PAGE_ARENA_WARM_128K=128 (default: 128)
- HAKMEM_PAGE_ARENA_WARM_2M=64 (default: 64)
Benchmark Results:
- Mid-Large MT (4T, 40K iter, 2KB):
- OFF: 84,535 page-faults, 726K ops/s
- ON: 84,534 page-faults, 760K ops/s (+4.7% ops, -0.001% faults)
- VM Mixed (200K iter):
- OFF: 102,134 page-faults, 257K ops/s
- ON: 102,134 page-faults, 255K ops/s (0% change)
Root Cause Analysis:
- Hypothesis: 50-66% page-fault reduction (80-100K → 30-40K)
- Actual: <1% page-fault reduction, minimal performance impact
- Reason: Structural limit - existing Arena/Pool/L25 already highly optimized
- 1MB chunk sizes with high-density linear carving
- TLS ring + exponential growth minimize mmap calls
- PageArena becomes double-buffering layer with no benefit
- Remaining page-faults from kernel zero-clear + app access patterns
Lessons Learned:
1. Mid/Large allocators already page-optimal via Arena/Pool design
2. Middle-layer caching ineffective when base layer already optimized
3. Page-fault reduction requires app-level access pattern changes
4. Tiny layer (Phase 23) remains best target for frontend optimization
Next Steps:
- Defer PageArena (low ROI, structural limit reached)
- Focus on upper layers (allocation pattern analysis, size distribution)
- Consider app-side access pattern optimization
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 03:22:27 +09:00
..
2025-11-17 02:47:58 +09:00
2025-11-17 02:47:58 +09:00
2025-11-14 05:41:49 +09:00
2025-11-14 01:02:00 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-08 17:08:00 +09:00
2025-11-08 17:08:00 +09:00
2025-11-14 22:09:14 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-13 14:05:39 +09:00
2025-11-17 03:22:27 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-16 01:26:48 +09:00
2025-11-16 01:26:48 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-08 12:54:52 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-06 21:54:12 +09:00
2025-11-07 01:27:04 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-17 02:47:58 +09:00
2025-11-17 02:47:58 +09:00
2025-11-11 01:47:06 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-16 03:21:13 +09:00
2025-11-16 03:21:13 +09:00
2025-11-16 03:21:13 +09:00
2025-11-16 01:51:43 +09:00
2025-11-16 00:38:29 +09:00
2025-11-16 00:38:29 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-15 01:42:57 +09:00
2025-11-05 12:31:14 +09:00
2025-11-15 01:42:57 +09:00
2025-11-13 06:50:20 +09:00
2025-11-14 01:02:00 +09:00
2025-11-05 12:31:14 +09:00
2025-11-13 06:50:20 +09:00
2025-11-13 16:33:03 +09:00
2025-11-13 06:50:20 +09:00
2025-11-07 01:27:04 +09:00
2025-11-13 14:25:54 +09:00
2025-11-13 14:25:54 +09:00
2025-11-05 12:31:14 +09:00
2025-11-14 05:41:49 +09:00
2025-11-14 05:41:49 +09:00
2025-11-13 06:50:20 +09:00
2025-11-13 06:50:20 +09:00
2025-11-13 06:50:20 +09:00
2025-11-14 01:05:30 +09:00
2025-11-12 13:57:46 +09:00
2025-11-14 01:02:00 +09:00
2025-11-17 02:47:58 +09:00
2025-11-13 16:33:03 +09:00
2025-11-13 16:33:03 +09:00
2025-11-05 12:31:14 +09:00
2025-11-10 16:48:20 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-14 01:02:00 +09:00
2025-11-14 05:41:49 +09:00
2025-11-14 05:41:49 +09:00
2025-11-14 05:41:49 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-13 13:32:58 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-15 14:35:44 +09:00
2025-11-07 01:27:04 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-07 01:27:04 +09:00
2025-11-14 01:02:00 +09:00
2025-11-11 00:02:24 +09:00
2025-11-14 01:02:00 +09:00
2025-11-14 06:49:32 +09:00
2025-11-14 01:02:00 +09:00
2025-11-13 05:43:31 +09:00
2025-11-13 16:33:03 +09:00
2025-11-10 16:48:20 +09:00
2025-11-13 05:21:36 +09:00
2025-11-16 02:37:24 +09:00
2025-11-17 02:47:58 +09:00
2025-11-16 01:26:48 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-16 07:51:37 +09:00
2025-11-05 12:31:14 +09:00
2025-11-11 01:47:06 +09:00
2025-11-10 18:04:08 +09:00
2025-11-05 12:31:14 +09:00
2025-11-17 03:22:27 +09:00
2025-11-17 03:22:27 +09:00
2025-11-17 03:22:27 +09:00
2025-11-09 16:49:34 +09:00
2025-11-08 23:53:25 +09:00
2025-11-17 03:22:27 +09:00
2025-11-09 18:55:50 +09:00
2025-11-09 18:55:50 +09:00
2025-11-14 15:00:13 +09:00
2025-11-14 15:00:13 +09:00
2025-11-14 14:29:05 +09:00
2025-11-09 18:55:50 +09:00
2025-11-14 14:29:05 +09:00
2025-11-09 18:55:50 +09:00
2025-11-14 15:32:07 +09:00
2025-11-09 18:55:50 +09:00
2025-11-14 01:02:00 +09:00
2025-11-13 06:50:20 +09:00
2025-11-14 01:02:00 +09:00
2025-11-13 14:25:54 +09:00
2025-11-13 14:25:54 +09:00
2025-11-14 01:05:30 +09:00
2025-11-17 02:47:58 +09:00
2025-11-17 02:47:58 +09:00
2025-11-13 13:32:58 +09:00
2025-11-17 02:47:58 +09:00
2025-11-06 21:54:12 +09:00
2025-11-14 01:02:00 +09:00
2025-11-13 06:50:20 +09:00
2025-11-14 05:41:49 +09:00
2025-11-14 05:41:49 +09:00
2025-11-13 16:33:03 +09:00
2025-11-14 01:02:00 +09:00
2025-11-14 01:02:00 +09:00
2025-11-13 06:50:20 +09:00
2025-11-13 06:50:20 +09:00
2025-11-09 23:15:02 +09:00
2025-11-17 02:47:58 +09:00
2025-11-14 01:34:59 +09:00
2025-11-14 01:02:00 +09:00
2025-11-07 01:27:04 +09:00
2025-11-13 06:50:20 +09:00
2025-11-07 01:27:04 +09:00
2025-11-05 12:31:14 +09:00
2025-11-07 01:27:04 +09:00
2025-11-07 18:07:48 +09:00
2025-11-13 06:50:20 +09:00
2025-11-07 18:07:48 +09:00
2025-11-13 06:50:20 +09:00
2025-11-07 01:27:04 +09:00
2025-11-13 16:33:03 +09:00
2025-11-05 12:31:14 +09:00
2025-11-11 21:49:05 +09:00
2025-11-07 01:27:04 +09:00
2025-11-05 12:31:14 +09:00
2025-11-14 01:02:00 +09:00
2025-11-14 06:49:32 +09:00
2025-11-06 21:54:12 +09:00
2025-11-07 22:34:24 +09:00
2025-11-05 12:31:14 +09:00