## Summary
Implemented Phase 12 Shared SuperSlab Pool (mimalloc-style) to address
SuperSlab allocation churn (877 SuperSlabs → 100-200 target).
## Implementation (ChatGPT + Claude)
1. **Metadata changes** (superslab_types.h):
- Added class_idx to TinySlabMeta (per-slab dynamic class)
- Removed size_class from SuperSlab (no longer per-SuperSlab)
- Changed owner_tid (16-bit) → owner_tid_low (8-bit)
2. **Shared Pool** (hakmem_shared_pool.{h,c}):
- Global pool shared by all size classes
- shared_pool_acquire_slab() - Get free slab for class_idx
- shared_pool_release_slab() - Return slab when empty
- Per-class hints for fast path optimization
3. **Integration** (23 files modified):
- Updated all ss->size_class → meta->class_idx
- Updated all meta->owner_tid → meta->owner_tid_low
- superslab_refill() now uses shared pool
- Free path releases empty slabs back to pool
4. **Build system** (Makefile):
- Added hakmem_shared_pool.o to OBJS_BASE and TINY_BENCH_OBJS_BASE
## Status: ⚠️ Build OK, Runtime CRASH
**Build**: ✅ SUCCESS
- All 23 files compile without errors
- Only warnings: superslab_allocate type mismatch (legacy code)
**Runtime**: ❌ SEGFAULT
- Crash location: sll_refill_small_from_ss()
- Exit code: 139 (SIGSEGV)
- Test case: ./bench_random_mixed_hakmem 1000 256 42
## Known Issues
1. **SEGFAULT in refill path** - Likely shared_pool_acquire_slab() issue
2. **Legacy superslab_allocate()** still exists (type mismatch warning)
3. **Remaining TODOs** from design doc:
- SuperSlab physical layout integration
- slab_handle.h cleanup
- Remove old per-class head implementation
## Next Steps
1. Debug SEGFAULT (gdb backtrace shows sll_refill_small_from_ss)
2. Fix shared_pool_acquire_slab() or superslab_init_slab()
3. Basic functionality test (1K → 100K iterations)
4. Measure SuperSlab count reduction (877 → 100-200)
5. Performance benchmark (+650-860% expected)
## Files Changed (25 files)
core/box/free_local_box.c
core/box/free_remote_box.c
core/box/front_gate_classifier.c
core/hakmem_super_registry.c
core/hakmem_tiny.c
core/hakmem_tiny_bg_spill.c
core/hakmem_tiny_free.inc
core/hakmem_tiny_lifecycle.inc
core/hakmem_tiny_magazine.c
core/hakmem_tiny_query.c
core/hakmem_tiny_refill.inc.h
core/hakmem_tiny_superslab.c
core/hakmem_tiny_superslab.h
core/hakmem_tiny_tls_ops.h
core/slab_handle.h
core/superslab/superslab_inline.h
core/superslab/superslab_types.h
core/tiny_debug.h
core/tiny_free_fast.inc.h
core/tiny_free_magazine.inc.h
core/tiny_remote.c
core/tiny_superslab_alloc.inc.h
core/tiny_superslab_free.inc.h
Makefile
## New Files (3 files)
PHASE12_SHARED_SUPERSLAB_POOL_DESIGN.md
core/hakmem_shared_pool.c
core/hakmem_shared_pool.h
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: ChatGPT <chatgpt@openai.com>
160 lines
6.0 KiB
Makefile
160 lines
6.0 KiB
Makefile
core/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/superslab/../tiny_box_geometry.h \
|
|
core/superslab/../hakmem_tiny_superslab_constants.h \
|
|
core/superslab/../hakmem_tiny_config.h \
|
|
core/superslab/../box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
|
|
core/tiny_nextptr.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_integrity.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/box/tls_sll_box.h core/box/../ptr_trace.h \
|
|
core/box/../hakmem_tiny_config.h core/box/../hakmem_build_flags.h \
|
|
core/box/../tiny_remote.h core/box/../tiny_region_id.h \
|
|
core/box/../hakmem_build_flags.h core/box/../tiny_box_geometry.h \
|
|
core/box/../ptr_track.h core/box/../hakmem_tiny_integrity.h \
|
|
core/box/../ptr_track.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/tiny_box_geometry.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/box/prewarm_box.h \
|
|
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/box/superslab_expansion_box.h \
|
|
core/box/../superslab/superslab_types.h core/box/../tiny_tls.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/tiny_fc_api.h
|
|
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/superslab/../tiny_box_geometry.h:
|
|
core/superslab/../hakmem_tiny_superslab_constants.h:
|
|
core/superslab/../hakmem_tiny_config.h:
|
|
core/superslab/../box/tiny_next_ptr_box.h:
|
|
core/hakmem_tiny_config.h:
|
|
core/tiny_nextptr.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_integrity.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/box/tls_sll_box.h:
|
|
core/box/../ptr_trace.h:
|
|
core/box/../hakmem_tiny_config.h:
|
|
core/box/../hakmem_build_flags.h:
|
|
core/box/../tiny_remote.h:
|
|
core/box/../tiny_region_id.h:
|
|
core/box/../hakmem_build_flags.h:
|
|
core/box/../tiny_box_geometry.h:
|
|
core/box/../ptr_track.h:
|
|
core/box/../hakmem_tiny_integrity.h:
|
|
core/box/../ptr_track.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/tiny_box_geometry.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/box/prewarm_box.h:
|
|
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/box/superslab_expansion_box.h:
|
|
core/box/../superslab/superslab_types.h:
|
|
core/box/../tiny_tls.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/tiny_fc_api.h:
|