- Root cause: header-based class indexing (HEADER_CLASSIDX=1) wrote a 1-byte header during allocation, but linear carve/refill and initial slab capacity still used bare class block sizes. This mismatch could overrun slab usable space and corrupt freelists, causing reproducible SEGV at ~100k iters. Changes - Superslab: compute capacity with effective stride (block_size + header for classes 0..6; class7 remains headerless) in superslab_init_slab(). Add a debug-only bound check in superslab_alloc_from_slab() to fail fast if carve would exceed usable bytes. - Refill (non-P0 and P0): use header-aware stride for all linear carving and TLS window bump operations. Ensure alignment/validation in tiny_refill_opt.h also uses stride, not raw class size. - Drain: keep existing defense-in-depth for remote sentinel and sanitize nodes before splicing into freelist (already present). Notes - This unifies the memory layout across alloc/linear-carve/refill with a single stride definition and keeps class7 (1024B) headerless as designed. - Debug builds add fail-fast checks; release builds remain lean. Next - Re-run Tiny benches (256/1024B) in debug to confirm stability, then in release. If any remaining crash persists, bisect with HAKMEM_TINY_P0_BATCH_REFILL=0 to isolate P0 batch carve, and continue reducing branch-miss as planned.
126 lines
4.6 KiB
Makefile
126 lines
4.6 KiB
Makefile
hakmem_tiny.o: core/hakmem_tiny.c core/hakmem_tiny.h \
|
|
core/hakmem_build_flags.h core/hakmem_trace.h \
|
|
core/hakmem_tiny_mini_mag.h core/hakmem_tiny_config.h \
|
|
core/hakmem_phase7_config.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/tiny_debug_ring.h \
|
|
core/tiny_remote.h core/hakmem_tiny_superslab_constants.h \
|
|
core/hakmem_super_registry.h core/hakmem_internal.h core/hakmem.h \
|
|
core/hakmem_config.h core/hakmem_features.h core/hakmem_sys.h \
|
|
core/hakmem_whale.h core/hakmem_syscall.h core/hakmem_tiny_magazine.h \
|
|
core/hakmem_tiny_batch_refill.h core/hakmem_tiny_stats.h core/tiny_api.h \
|
|
core/hakmem_tiny_stats_api.h core/hakmem_tiny_query_api.h \
|
|
core/hakmem_tiny_rss_api.h core/hakmem_tiny_registry_api.h \
|
|
core/tiny_tls.h core/tiny_debug.h core/tiny_mmap_gate.h \
|
|
core/tiny_refill.h core/slab_handle.h core/tiny_sticky.h \
|
|
core/tiny_ready.h core/box/mailbox_box.h core/hakmem_tiny_superslab.h \
|
|
core/tiny_remote_bg.h core/hakmem_tiny_remote_target.h \
|
|
core/tiny_ready_bg.h core/tiny_route.h core/box/adopt_gate_box.h \
|
|
core/tiny_tls_guard.h core/hakmem_tiny_tls_list.h \
|
|
core/hakmem_tiny_bg_spill.h core/tiny_adaptive_sizing.h \
|
|
core/tiny_system.h core/hakmem_prof.h core/tiny_publish.h \
|
|
core/hakmem_tiny_hotmag.inc.h core/hakmem_tiny_hot_pop.inc.h \
|
|
core/hakmem_tiny_fastcache.inc.h core/hakmem_tiny_refill.inc.h \
|
|
core/hakmem_tiny_refill_p0.inc.h core/tiny_refill_opt.h \
|
|
core/hakmem_tiny_ultra_front.inc.h core/hakmem_tiny_intel.inc \
|
|
core/hakmem_tiny_background.inc core/hakmem_tiny_bg_bin.inc.h \
|
|
core/hakmem_tiny_tls_ops.h core/hakmem_tiny_remote.inc \
|
|
core/hakmem_tiny_init.inc core/hakmem_tiny_bump.inc.h \
|
|
core/hakmem_tiny_smallmag.inc.h core/tiny_atomic.h \
|
|
core/tiny_alloc_fast.inc.h core/tiny_alloc_fast_sfc.inc.h \
|
|
core/tiny_region_id.h core/tiny_alloc_fast_inline.h \
|
|
core/tiny_free_fast.inc.h core/hakmem_tiny_alloc.inc \
|
|
core/hakmem_tiny_slow.inc core/hakmem_tiny_free.inc \
|
|
core/box/free_publish_box.h core/mid_tcache.h \
|
|
core/tiny_free_magazine.inc.h core/tiny_superslab_alloc.inc.h \
|
|
core/tiny_superslab_free.inc.h core/box/free_remote_box.h \
|
|
core/box/free_local_box.h core/hakmem_tiny_lifecycle.inc \
|
|
core/hakmem_tiny_slab_mgmt.inc
|
|
core/hakmem_tiny.h:
|
|
core/hakmem_build_flags.h:
|
|
core/hakmem_trace.h:
|
|
core/hakmem_tiny_mini_mag.h:
|
|
core/hakmem_tiny_config.h:
|
|
core/hakmem_phase7_config.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/tiny_debug_ring.h:
|
|
core/tiny_remote.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/hakmem_super_registry.h:
|
|
core/hakmem_internal.h:
|
|
core/hakmem.h:
|
|
core/hakmem_config.h:
|
|
core/hakmem_features.h:
|
|
core/hakmem_sys.h:
|
|
core/hakmem_whale.h:
|
|
core/hakmem_syscall.h:
|
|
core/hakmem_tiny_magazine.h:
|
|
core/hakmem_tiny_batch_refill.h:
|
|
core/hakmem_tiny_stats.h:
|
|
core/tiny_api.h:
|
|
core/hakmem_tiny_stats_api.h:
|
|
core/hakmem_tiny_query_api.h:
|
|
core/hakmem_tiny_rss_api.h:
|
|
core/hakmem_tiny_registry_api.h:
|
|
core/tiny_tls.h:
|
|
core/tiny_debug.h:
|
|
core/tiny_mmap_gate.h:
|
|
core/tiny_refill.h:
|
|
core/slab_handle.h:
|
|
core/tiny_sticky.h:
|
|
core/tiny_ready.h:
|
|
core/box/mailbox_box.h:
|
|
core/hakmem_tiny_superslab.h:
|
|
core/tiny_remote_bg.h:
|
|
core/hakmem_tiny_remote_target.h:
|
|
core/tiny_ready_bg.h:
|
|
core/tiny_route.h:
|
|
core/box/adopt_gate_box.h:
|
|
core/tiny_tls_guard.h:
|
|
core/hakmem_tiny_tls_list.h:
|
|
core/hakmem_tiny_bg_spill.h:
|
|
core/tiny_adaptive_sizing.h:
|
|
core/tiny_system.h:
|
|
core/hakmem_prof.h:
|
|
core/tiny_publish.h:
|
|
core/hakmem_tiny_hotmag.inc.h:
|
|
core/hakmem_tiny_hot_pop.inc.h:
|
|
core/hakmem_tiny_fastcache.inc.h:
|
|
core/hakmem_tiny_refill.inc.h:
|
|
core/hakmem_tiny_refill_p0.inc.h:
|
|
core/tiny_refill_opt.h:
|
|
core/hakmem_tiny_ultra_front.inc.h:
|
|
core/hakmem_tiny_intel.inc:
|
|
core/hakmem_tiny_background.inc:
|
|
core/hakmem_tiny_bg_bin.inc.h:
|
|
core/hakmem_tiny_tls_ops.h:
|
|
core/hakmem_tiny_remote.inc:
|
|
core/hakmem_tiny_init.inc:
|
|
core/hakmem_tiny_bump.inc.h:
|
|
core/hakmem_tiny_smallmag.inc.h:
|
|
core/tiny_atomic.h:
|
|
core/tiny_alloc_fast.inc.h:
|
|
core/tiny_alloc_fast_sfc.inc.h:
|
|
core/tiny_region_id.h:
|
|
core/tiny_alloc_fast_inline.h:
|
|
core/tiny_free_fast.inc.h:
|
|
core/hakmem_tiny_alloc.inc:
|
|
core/hakmem_tiny_slow.inc:
|
|
core/hakmem_tiny_free.inc:
|
|
core/box/free_publish_box.h:
|
|
core/mid_tcache.h:
|
|
core/tiny_free_magazine.inc.h:
|
|
core/tiny_superslab_alloc.inc.h:
|
|
core/tiny_superslab_free.inc.h:
|
|
core/box/free_remote_box.h:
|
|
core/box/free_local_box.h:
|
|
core/hakmem_tiny_lifecycle.inc:
|
|
core/hakmem_tiny_slab_mgmt.inc:
|