**P0-2: Lock Instrumentation** (✅ Complete) - Add atomic counters to g_shared_pool.alloc_lock - Track acquire_slab() vs release_slab() separately - Environment: HAKMEM_SHARED_POOL_LOCK_STATS=1 - Report stats at shutdown via destructor **P0-3: Analysis Results** (✅ Complete) - 100% contention from acquire_slab() (allocation path) - 0% from release_slab() (effectively lock-free!) - Lock rate: 0.206% (TLS hit rate: 99.8%) - Scaling: 4T→8T = 1.44x (sublinear, lock bottleneck) **Key Findings**: - 4T: 330 lock acquisitions / 160K ops - 8T: 658 lock acquisitions / 320K ops - futex: 68% of syscall time (from previous strace) - Bottleneck: acquire_slab 3-stage logic under mutex **Report**: MID_LARGE_LOCK_CONTENTION_ANALYSIS.md (2.3KB) - Detailed breakdown by code path - Root cause analysis (TLS miss → shared pool lock) - Lock-free implementation roadmap (P0-4/P0-5) - Expected impact: +50-73% throughput **Files Modified**: - core/hakmem_shared_pool.c: +60 lines instrumentation - Atomic counters: g_lock_acquire/release_slab_count - lock_stats_init() + lock_stats_report() - Per-path tracking in acquire/release functions **Next Steps**: - P0-4: Lock-free per-class free lists (Stage 1: LIFO stack CAS) - P0-5: Lock-free slot claiming (Stage 2: atomic bitmap) - P0-6: A/B comparison (target: +50-73%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
108 lines
4.1 KiB
Makefile
108 lines
4.1 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/../pool_tls.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_gate_classifier.h \
|
|
core/box/hak_wrappers.inc.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/../pool_tls.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_gate_classifier.h:
|
|
core/box/hak_wrappers.inc.h:
|