Summary: ======== Phase 17-1 implements Small-Mid allocator as TLS frontend cache with Tiny backend delegation. Result: Clean layer separation achieved with minimal overhead (±0.3%), but no performance gain. Conclusion: Frontend-only approach is dead end. Phase 17-2 (dedicated backend) required for 2-3x target. Implementation: =============== 1. Small-Mid TLS frontend (256B/512B/1KB - 3 classes) - TLS freelist (32/24/16 capacity) - Backend delegation to Tiny C5/C6/C7 - Header conversion (0xa0 → 0xb0) 2. Auto-adjust Tiny boundary - When Small-Mid ON: Tiny auto-limits to C0-C5 (0-255B) - When Small-Mid OFF: Tiny default C0-C7 (0-1023B) - Prevents routing conflict 3. Routing order fix - Small-Mid BEFORE Tiny (critical for proper execution) - Fall-through on TLS miss Files Modified: =============== - core/hakmem_smallmid.h/c: TLS freelist + backend delegation - core/hakmem_tiny.c: tiny_get_max_size() auto-adjust - core/box/hak_alloc_api.inc.h: Routing order (Small-Mid → Tiny) - CURRENT_TASK.md: Phase 17-1 results + Phase 17-2 plan A/B Benchmark Results: ====================== | Size | Config A (OFF) | Config B (ON) | Delta | % Change | |--------|----------------|---------------|----------|----------| | 256B | 5.87M ops/s | 6.06M ops/s | +191K | +3.3% | | 512B | 6.02M ops/s | 5.91M ops/s | -112K | -1.9% | | 1024B | 5.58M ops/s | 5.54M ops/s | -35K | -0.6% | | Overall| 5.82M ops/s | 5.84M ops/s | +20K | +0.3% | Analysis: ========= ✅ SUCCESS: Clean layer separation (Small-Mid ↔ Tiny coexist) ✅ SUCCESS: Minimal overhead (±0.3% = measurement noise) ❌ FAIL: No performance gain (target was 2-4x) Root Cause: ----------- - Delegation overhead = TLS savings (net gain ≈ 0 instructions) - Small-Mid TLS alloc: ~3-5 instructions - Tiny backend delegation: ~3-5 instructions - Header conversion: ~2 instructions - No batching: 1:1 delegation to Tiny (no refill amortization) Lessons Learned: ================ - Frontend-only approach ineffective (backend calls not reduced) - Dedicated backend essential for meaningful improvement - Clean separation achieved = solid foundation for Phase 17-2 Next Steps (Phase 17-2): ======================== - Dedicated Small-Mid SuperSlab backend (separate from Tiny) - TLS batch refill (8-16 blocks per refill) - Optimized 0xb0 header fast path (no delegation) - Target: 12-15M ops/s (2.0-2.6x improvement) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
119 lines
4.6 KiB
Makefile
119 lines
4.6 KiB
Makefile
hakmem.o: core/hakmem.c core/hakmem.h core/hakmem_build_flags.h \
|
|
core/hakmem_config.h core/hakmem_features.h core/hakmem_internal.h \
|
|
core/hakmem_sys.h core/hakmem_whale.h core/hakmem_bigcache.h \
|
|
core/hakmem_pool.h core/hakmem_l25_pool.h core/hakmem_policy.h \
|
|
core/hakmem_learner.h core/hakmem_size_hist.h core/hakmem_ace.h \
|
|
core/hakmem_site_rules.h core/hakmem_tiny.h core/hakmem_trace.h \
|
|
core/hakmem_tiny_mini_mag.h core/hakmem_tiny_superslab.h \
|
|
core/superslab/superslab_types.h core/hakmem_tiny_superslab_constants.h \
|
|
core/superslab/superslab_inline.h core/superslab/superslab_types.h \
|
|
core/tiny_debug_ring.h core/tiny_remote.h \
|
|
core/hakmem_tiny_superslab_constants.h core/tiny_fastcache.h \
|
|
core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
|
|
core/tiny_nextptr.h core/hakmem_mid_mt.h core/hakmem_super_registry.h \
|
|
core/hakmem_elo.h core/hakmem_ace_stats.h core/hakmem_batch.h \
|
|
core/hakmem_evo.h core/hakmem_debug.h core/hakmem_prof.h \
|
|
core/hakmem_syscall.h core/hakmem_ace_controller.h \
|
|
core/hakmem_ace_metrics.h core/hakmem_ace_ucb1.h core/ptr_trace.h \
|
|
core/box/hak_exit_debug.inc.h core/box/hak_kpi_util.inc.h \
|
|
core/box/hak_core_init.inc.h core/hakmem_phase7_config.h \
|
|
core/box/hak_alloc_api.inc.h core/box/../hakmem_tiny.h \
|
|
core/box/../hakmem_smallmid.h core/box/hak_free_api.inc.h \
|
|
core/hakmem_tiny_superslab.h core/box/../tiny_free_fast_v2.inc.h \
|
|
core/box/../tiny_region_id.h core/box/../hakmem_build_flags.h \
|
|
core/box/../tiny_box_geometry.h \
|
|
core/box/../hakmem_tiny_superslab_constants.h \
|
|
core/box/../hakmem_tiny_config.h core/box/../ptr_track.h \
|
|
core/box/../box/tls_sll_box.h core/box/../box/../hakmem_tiny_config.h \
|
|
core/box/../box/../hakmem_build_flags.h core/box/../box/../tiny_remote.h \
|
|
core/box/../box/../tiny_region_id.h \
|
|
core/box/../box/../hakmem_tiny_integrity.h \
|
|
core/box/../box/../hakmem_tiny.h core/box/../box/../ptr_track.h \
|
|
core/box/../box/../tiny_debug_ring.h core/box/../box/tls_sll_drain_box.h \
|
|
core/box/../box/tls_sll_box.h core/box/../box/free_local_box.h \
|
|
core/box/../hakmem_tiny_integrity.h core/box/../front/tiny_heap_v2.h \
|
|
core/box/../front/../hakmem_tiny.h core/box/../front/tiny_ultra_hot.h \
|
|
core/box/../front/../box/tls_sll_box.h core/box/front_gate_v2.h \
|
|
core/box/external_guard_box.h core/box/hak_wrappers.inc.h \
|
|
core/box/front_gate_classifier.h
|
|
core/hakmem.h:
|
|
core/hakmem_build_flags.h:
|
|
core/hakmem_config.h:
|
|
core/hakmem_features.h:
|
|
core/hakmem_internal.h:
|
|
core/hakmem_sys.h:
|
|
core/hakmem_whale.h:
|
|
core/hakmem_bigcache.h:
|
|
core/hakmem_pool.h:
|
|
core/hakmem_l25_pool.h:
|
|
core/hakmem_policy.h:
|
|
core/hakmem_learner.h:
|
|
core/hakmem_size_hist.h:
|
|
core/hakmem_ace.h:
|
|
core/hakmem_site_rules.h:
|
|
core/hakmem_tiny.h:
|
|
core/hakmem_trace.h:
|
|
core/hakmem_tiny_mini_mag.h:
|
|
core/hakmem_tiny_superslab.h:
|
|
core/superslab/superslab_types.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/superslab/superslab_inline.h:
|
|
core/superslab/superslab_types.h:
|
|
core/tiny_debug_ring.h:
|
|
core/tiny_remote.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/tiny_fastcache.h:
|
|
core/box/tiny_next_ptr_box.h:
|
|
core/hakmem_tiny_config.h:
|
|
core/tiny_nextptr.h:
|
|
core/hakmem_mid_mt.h:
|
|
core/hakmem_super_registry.h:
|
|
core/hakmem_elo.h:
|
|
core/hakmem_ace_stats.h:
|
|
core/hakmem_batch.h:
|
|
core/hakmem_evo.h:
|
|
core/hakmem_debug.h:
|
|
core/hakmem_prof.h:
|
|
core/hakmem_syscall.h:
|
|
core/hakmem_ace_controller.h:
|
|
core/hakmem_ace_metrics.h:
|
|
core/hakmem_ace_ucb1.h:
|
|
core/ptr_trace.h:
|
|
core/box/hak_exit_debug.inc.h:
|
|
core/box/hak_kpi_util.inc.h:
|
|
core/box/hak_core_init.inc.h:
|
|
core/hakmem_phase7_config.h:
|
|
core/box/hak_alloc_api.inc.h:
|
|
core/box/../hakmem_tiny.h:
|
|
core/box/../hakmem_smallmid.h:
|
|
core/box/hak_free_api.inc.h:
|
|
core/hakmem_tiny_superslab.h:
|
|
core/box/../tiny_free_fast_v2.inc.h:
|
|
core/box/../tiny_region_id.h:
|
|
core/box/../hakmem_build_flags.h:
|
|
core/box/../tiny_box_geometry.h:
|
|
core/box/../hakmem_tiny_superslab_constants.h:
|
|
core/box/../hakmem_tiny_config.h:
|
|
core/box/../ptr_track.h:
|
|
core/box/../box/tls_sll_box.h:
|
|
core/box/../box/../hakmem_tiny_config.h:
|
|
core/box/../box/../hakmem_build_flags.h:
|
|
core/box/../box/../tiny_remote.h:
|
|
core/box/../box/../tiny_region_id.h:
|
|
core/box/../box/../hakmem_tiny_integrity.h:
|
|
core/box/../box/../hakmem_tiny.h:
|
|
core/box/../box/../ptr_track.h:
|
|
core/box/../box/../tiny_debug_ring.h:
|
|
core/box/../box/tls_sll_drain_box.h:
|
|
core/box/../box/tls_sll_box.h:
|
|
core/box/../box/free_local_box.h:
|
|
core/box/../hakmem_tiny_integrity.h:
|
|
core/box/../front/tiny_heap_v2.h:
|
|
core/box/../front/../hakmem_tiny.h:
|
|
core/box/../front/tiny_ultra_hot.h:
|
|
core/box/../front/../box/tls_sll_box.h:
|
|
core/box/front_gate_v2.h:
|
|
core/box/external_guard_box.h:
|
|
core/box/hak_wrappers.inc.h:
|
|
core/box/front_gate_classifier.h:
|