## Phase 1: Utilization-Aware Superslab Tiering (案B実装済) - Add ss_tier_box.h: Classify SuperSlabs into HOT/DRAINING/FREE based on utilization - HOT (>25%): Accept new allocations - DRAINING (≤25%): Drain only, no new allocs - FREE (0%): Ready for eager munmap - Enhanced shared_pool_release_slab(): - Check tier transition after each slab release - If tier→FREE: Force remaining slots to EMPTY and call superslab_free() immediately - Bypasses LRU cache to prevent registry bloat from accumulating DRAINING SuperSlabs - Test results (bench_random_mixed_hakmem): - 1M iterations: ✅ ~1.03M ops/s (previously passed) - 10M iterations: ✅ ~1.15M ops/s (previously: registry full error) - 50M iterations: ✅ ~1.08M ops/s (stress test) ## Phase 2: Tiny Front Routing Policy (新規Box) - Add tiny_route_box.h/c: Single 8-byte table for class→routing decisions - ROUTE_TINY_ONLY: Tiny front exclusive (no fallback) - ROUTE_TINY_FIRST: Try Tiny, fallback to Pool if fails - ROUTE_POOL_ONLY: Skip Tiny entirely - Profiles via HAKMEM_TINY_PROFILE ENV: - "hot": C0-C3=TINY_ONLY, C4-C6=TINY_FIRST, C7=POOL_ONLY - "conservative" (default): All TINY_FIRST - "off": All POOL_ONLY (disable Tiny) - "full": All TINY_ONLY (microbench mode) - A/B test results (ws=256, 100k ops random_mixed): - Default (conservative): ~2.90M ops/s - hot: ~2.65M ops/s (more conservative) - off: ~2.86M ops/s - full: ~2.98M ops/s (slightly best) ## Design Rationale ### Registry Pressure Fix (案B) - Problem: DRAINING tier SS occupied registry indefinitely - Solution: When total_active_blocks→0, immediately free to clear registry slot - Result: No more "registry full" errors under stress ### Routing Policy Box (新) - Problem: Tiny front optimization scattered across ENV/branches - Solution: Centralize routing in single table, select profiles via ENV - Benefit: Safe A/B testing without touching hot path code - Future: Integrate with RSS budget/learning layers for dynamic profile switching ## Next Steps (性能最適化) - Profile Tiny front internals (TLS SLL, FastCache, Superslab backend latency) - Identify bottleneck between current ~2.9M ops/s and mimalloc ~100M ops/s - Consider: - Reduce shared pool lock contention - Optimize unified cache hit rate - Streamline Superslab carving logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
253 lines
10 KiB
Makefile
253 lines
10 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/box/ptr_type_box.h \
|
|
core/hakmem_bigcache.h core/hakmem_pool.h \
|
|
core/box/hak_lane_classify.inc.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/superslab/../tiny_box_geometry.h \
|
|
core/superslab/../hakmem_tiny_superslab_constants.h \
|
|
core/superslab/../hakmem_tiny_config.h core/tiny_debug_ring.h \
|
|
core/tiny_remote.h core/hakmem_tiny_superslab_constants.h \
|
|
core/tiny_fastcache.h core/hakmem_env_cache.h \
|
|
core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
|
|
core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \
|
|
core/ptr_track.h core/hakmem_super_registry.h core/box/ss_addr_map_box.h \
|
|
core/box/../hakmem_build_flags.h core/tiny_debug_api.h \
|
|
core/box/tiny_layout_box.h core/box/../hakmem_tiny_config.h \
|
|
core/box/tiny_header_box.h core/box/tiny_layout_box.h \
|
|
core/box/../tiny_region_id.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/box/bench_fast_box.h core/ptr_trace.h core/hakmem_trace_master.h \
|
|
core/hakmem_stats_master.h core/box/hak_kpi_util.inc.h \
|
|
core/box/hak_core_init.inc.h core/hakmem_phase7_config.h \
|
|
core/box/ss_hot_prewarm_box.h core/box/hak_alloc_api.inc.h \
|
|
core/box/../hakmem_tiny.h core/box/../hakmem_pool.h \
|
|
core/box/../hakmem_smallmid.h core/box/mid_large_config_box.h \
|
|
core/box/../hakmem_config.h core/box/../hakmem_features.h \
|
|
core/box/hak_free_api.inc.h core/hakmem_tiny_superslab.h \
|
|
core/box/../hakmem_trace_master.h core/box/front_gate_v2.h \
|
|
core/box/external_guard_box.h core/box/../hakmem_stats_master.h \
|
|
core/box/ss_slab_meta_box.h core/box/../superslab/superslab_types.h \
|
|
core/box/slab_freelist_atomic.h core/box/fg_tiny_gate_box.h \
|
|
core/box/tiny_free_gate_box.h core/box/ptr_type_box.h \
|
|
core/box/ptr_conversion_box.h core/box/tiny_ptr_bridge_box.h \
|
|
core/box/../hakmem_tiny_superslab_internal.h \
|
|
core/box/../hakmem_build_flags.h core/box/../hakmem_tiny_superslab.h \
|
|
core/box/../box/ss_hot_cold_box.h \
|
|
core/box/../box/../superslab/superslab_types.h \
|
|
core/box/../box/ss_allocation_box.h core/box/../hakmem_debug_master.h \
|
|
core/box/../hakmem_tiny.h core/box/../hakmem_tiny_config.h \
|
|
core/box/../hakmem_shared_pool.h core/box/../superslab/superslab_types.h \
|
|
core/box/../hakmem_internal.h core/box/../tiny_region_id.h \
|
|
core/box/../hakmem_tiny_integrity.h \
|
|
core/box/../box/slab_freelist_atomic.h \
|
|
core/box/../tiny_free_fast_v2.inc.h core/box/../box/tls_sll_box.h \
|
|
core/box/../box/../hakmem_internal.h \
|
|
core/box/../box/../hakmem_tiny_config.h \
|
|
core/box/../box/../hakmem_build_flags.h \
|
|
core/box/../box/../hakmem_debug_master.h \
|
|
core/box/../box/../tiny_remote.h core/box/../box/../tiny_region_id.h \
|
|
core/box/../box/../hakmem_tiny_integrity.h \
|
|
core/box/../box/../ptr_track.h core/box/../box/../tiny_debug_ring.h \
|
|
core/box/../box/ss_addr_map_box.h \
|
|
core/box/../box/../superslab/superslab_inline.h \
|
|
core/box/../box/tiny_ptr_bridge_box.h core/box/../box/tiny_header_box.h \
|
|
core/box/../box/tls_sll_drain_box.h core/box/../box/tls_sll_box.h \
|
|
core/box/../box/slab_recycling_box.h \
|
|
core/box/../box/../hakmem_tiny_superslab.h \
|
|
core/box/../box/ss_hot_cold_box.h core/box/../box/ss_release_guard_box.h \
|
|
core/box/../box/../hakmem_tiny_superslab_internal.h \
|
|
core/box/../box/free_local_box.h core/box/../box/ptr_type_box.h \
|
|
core/box/../box/free_publish_box.h core/hakmem_tiny.h \
|
|
core/tiny_region_id.h core/box/../hakmem_env_cache.h \
|
|
core/box/../superslab/superslab_inline.h \
|
|
core/box/../box/ss_slab_meta_box.h core/box/../box/free_remote_box.h \
|
|
core/hakmem_tiny_integrity.h core/box/../box/ptr_conversion_box.h \
|
|
core/box/hak_exit_debug.inc.h core/box/hak_wrappers.inc.h \
|
|
core/box/front_gate_classifier.h core/box/../front/malloc_tiny_fast.h \
|
|
core/box/../front/../hakmem_build_flags.h \
|
|
core/box/../front/../hakmem_tiny_config.h \
|
|
core/box/../front/../superslab/superslab_inline.h \
|
|
core/box/../front/../box/ss_slab_meta_box.h \
|
|
core/box/../front/tiny_unified_cache.h \
|
|
core/box/../front/../box/ptr_type_box.h \
|
|
core/box/../front/../box/tiny_front_config_box.h \
|
|
core/box/../front/../box/../hakmem_build_flags.h \
|
|
core/box/../front/../tiny_region_id.h core/box/../front/../hakmem_tiny.h \
|
|
core/box/../front/../box/tiny_front_hot_box.h \
|
|
core/box/../front/../box/../hakmem_tiny_config.h \
|
|
core/box/../front/../box/../tiny_region_id.h \
|
|
core/box/../front/../box/../front/tiny_unified_cache.h \
|
|
core/box/../front/../box/tiny_layout_box.h \
|
|
core/box/../front/../box/tiny_front_cold_box.h \
|
|
core/box/tiny_alloc_gate_box.h core/box/tiny_route_box.h \
|
|
core/box/tiny_front_config_box.h core/box/wrapper_env_box.h \
|
|
core/box/../hakmem_internal.h core/box/../superslab/superslab_inline.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/box/ptr_type_box.h:
|
|
core/hakmem_bigcache.h:
|
|
core/hakmem_pool.h:
|
|
core/box/hak_lane_classify.inc.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/superslab/../tiny_box_geometry.h:
|
|
core/superslab/../hakmem_tiny_superslab_constants.h:
|
|
core/superslab/../hakmem_tiny_config.h:
|
|
core/tiny_debug_ring.h:
|
|
core/tiny_remote.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/tiny_fastcache.h:
|
|
core/hakmem_env_cache.h:
|
|
core/box/tiny_next_ptr_box.h:
|
|
core/hakmem_tiny_config.h:
|
|
core/tiny_nextptr.h:
|
|
core/tiny_region_id.h:
|
|
core/tiny_box_geometry.h:
|
|
core/ptr_track.h:
|
|
core/hakmem_super_registry.h:
|
|
core/box/ss_addr_map_box.h:
|
|
core/box/../hakmem_build_flags.h:
|
|
core/tiny_debug_api.h:
|
|
core/box/tiny_layout_box.h:
|
|
core/box/../hakmem_tiny_config.h:
|
|
core/box/tiny_header_box.h:
|
|
core/box/tiny_layout_box.h:
|
|
core/box/../tiny_region_id.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/box/bench_fast_box.h:
|
|
core/ptr_trace.h:
|
|
core/hakmem_trace_master.h:
|
|
core/hakmem_stats_master.h:
|
|
core/box/hak_kpi_util.inc.h:
|
|
core/box/hak_core_init.inc.h:
|
|
core/hakmem_phase7_config.h:
|
|
core/box/ss_hot_prewarm_box.h:
|
|
core/box/hak_alloc_api.inc.h:
|
|
core/box/../hakmem_tiny.h:
|
|
core/box/../hakmem_pool.h:
|
|
core/box/../hakmem_smallmid.h:
|
|
core/box/mid_large_config_box.h:
|
|
core/box/../hakmem_config.h:
|
|
core/box/../hakmem_features.h:
|
|
core/box/hak_free_api.inc.h:
|
|
core/hakmem_tiny_superslab.h:
|
|
core/box/../hakmem_trace_master.h:
|
|
core/box/front_gate_v2.h:
|
|
core/box/external_guard_box.h:
|
|
core/box/../hakmem_stats_master.h:
|
|
core/box/ss_slab_meta_box.h:
|
|
core/box/../superslab/superslab_types.h:
|
|
core/box/slab_freelist_atomic.h:
|
|
core/box/fg_tiny_gate_box.h:
|
|
core/box/tiny_free_gate_box.h:
|
|
core/box/ptr_type_box.h:
|
|
core/box/ptr_conversion_box.h:
|
|
core/box/tiny_ptr_bridge_box.h:
|
|
core/box/../hakmem_tiny_superslab_internal.h:
|
|
core/box/../hakmem_build_flags.h:
|
|
core/box/../hakmem_tiny_superslab.h:
|
|
core/box/../box/ss_hot_cold_box.h:
|
|
core/box/../box/../superslab/superslab_types.h:
|
|
core/box/../box/ss_allocation_box.h:
|
|
core/box/../hakmem_debug_master.h:
|
|
core/box/../hakmem_tiny.h:
|
|
core/box/../hakmem_tiny_config.h:
|
|
core/box/../hakmem_shared_pool.h:
|
|
core/box/../superslab/superslab_types.h:
|
|
core/box/../hakmem_internal.h:
|
|
core/box/../tiny_region_id.h:
|
|
core/box/../hakmem_tiny_integrity.h:
|
|
core/box/../box/slab_freelist_atomic.h:
|
|
core/box/../tiny_free_fast_v2.inc.h:
|
|
core/box/../box/tls_sll_box.h:
|
|
core/box/../box/../hakmem_internal.h:
|
|
core/box/../box/../hakmem_tiny_config.h:
|
|
core/box/../box/../hakmem_build_flags.h:
|
|
core/box/../box/../hakmem_debug_master.h:
|
|
core/box/../box/../tiny_remote.h:
|
|
core/box/../box/../tiny_region_id.h:
|
|
core/box/../box/../hakmem_tiny_integrity.h:
|
|
core/box/../box/../ptr_track.h:
|
|
core/box/../box/../tiny_debug_ring.h:
|
|
core/box/../box/ss_addr_map_box.h:
|
|
core/box/../box/../superslab/superslab_inline.h:
|
|
core/box/../box/tiny_ptr_bridge_box.h:
|
|
core/box/../box/tiny_header_box.h:
|
|
core/box/../box/tls_sll_drain_box.h:
|
|
core/box/../box/tls_sll_box.h:
|
|
core/box/../box/slab_recycling_box.h:
|
|
core/box/../box/../hakmem_tiny_superslab.h:
|
|
core/box/../box/ss_hot_cold_box.h:
|
|
core/box/../box/ss_release_guard_box.h:
|
|
core/box/../box/../hakmem_tiny_superslab_internal.h:
|
|
core/box/../box/free_local_box.h:
|
|
core/box/../box/ptr_type_box.h:
|
|
core/box/../box/free_publish_box.h:
|
|
core/hakmem_tiny.h:
|
|
core/tiny_region_id.h:
|
|
core/box/../hakmem_env_cache.h:
|
|
core/box/../superslab/superslab_inline.h:
|
|
core/box/../box/ss_slab_meta_box.h:
|
|
core/box/../box/free_remote_box.h:
|
|
core/hakmem_tiny_integrity.h:
|
|
core/box/../box/ptr_conversion_box.h:
|
|
core/box/hak_exit_debug.inc.h:
|
|
core/box/hak_wrappers.inc.h:
|
|
core/box/front_gate_classifier.h:
|
|
core/box/../front/malloc_tiny_fast.h:
|
|
core/box/../front/../hakmem_build_flags.h:
|
|
core/box/../front/../hakmem_tiny_config.h:
|
|
core/box/../front/../superslab/superslab_inline.h:
|
|
core/box/../front/../box/ss_slab_meta_box.h:
|
|
core/box/../front/tiny_unified_cache.h:
|
|
core/box/../front/../box/ptr_type_box.h:
|
|
core/box/../front/../box/tiny_front_config_box.h:
|
|
core/box/../front/../box/../hakmem_build_flags.h:
|
|
core/box/../front/../tiny_region_id.h:
|
|
core/box/../front/../hakmem_tiny.h:
|
|
core/box/../front/../box/tiny_front_hot_box.h:
|
|
core/box/../front/../box/../hakmem_tiny_config.h:
|
|
core/box/../front/../box/../tiny_region_id.h:
|
|
core/box/../front/../box/../front/tiny_unified_cache.h:
|
|
core/box/../front/../box/tiny_layout_box.h:
|
|
core/box/../front/../box/tiny_front_cold_box.h:
|
|
core/box/tiny_alloc_gate_box.h:
|
|
core/box/tiny_route_box.h:
|
|
core/box/tiny_front_config_box.h:
|
|
core/box/wrapper_env_box.h:
|
|
core/box/../hakmem_internal.h:
|
|
core/box/../superslab/superslab_inline.h:
|