|
|
38552c3f39
|
Phase 3d-A: SlabMeta Box boundary - Encapsulate SuperSlab metadata access
ChatGPT-guided Box theory refactoring (Phase A: Boundary only).
Changes:
- Created ss_slab_meta_box.h with 15 inline accessor functions
- HOT fields (8): freelist, used, capacity (fast path)
- COLD fields (6): class_idx, carved, owner_tid_low (init/debug)
- Legacy (1): ss_slab_meta_ptr() for atomic ops
- Migrated 14 direct slabs[] access sites across 6 files
- hakmem_shared_pool.c (4 sites)
- tiny_free_fast_v2.inc.h (1 site)
- hakmem_tiny.c (3 sites)
- external_guard_box.h (1 site)
- hakmem_tiny_lifecycle.inc (1 site)
- ss_allocation_box.c (4 sites)
Architecture:
- Zero overhead (static inline wrappers)
- Single point of change for future layout optimizations
- Enables Hot/Cold split (Phase C) without touching call sites
- A/B testing support via compile-time flags
Verification:
- Build: ✅ Success (no errors)
- Stability: ✅ All sizes pass (128B-1KB, 22-24M ops/s)
- Behavior: Unchanged (thin wrapper, no logic changes)
Next: Phase B (TLS Cache Merge, +12-18% expected)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-20 02:01:52 +09:00 |
|
|
|
6199e9ba01
|
Phase 15 Box Separation: Fix wrapper domain check to prevent BenchMeta→CoreAlloc violation
Fix free() wrapper unconditionally routing ALL pointers to hak_free_at(),
causing Box boundary violations (BenchMeta slots[] entering CoreAlloc).
Solution: Add domain check in wrapper using 1-byte header inspection:
- Non-page-aligned: Check ptr-1 for HEADER_MAGIC (0xa0/0xb0)
- Hakmem Tiny → route to hak_free_at()
- External/BenchMeta → route to __libc_free()
- Page-aligned: Full classification (cannot safely check header)
Results:
- 99.29% BenchMeta properly freed via __libc_free() ✅
- 0.71% page-aligned fallthrough → ExternalGuard leak (acceptable)
- No crashes (100K/500K iterations stable)
- Performance: 15.3M ops/s (maintained)
Changes:
- core/box/hak_wrappers.inc.h: Domain check logic (lines 227-256)
- core/box/external_guard_box.h: Conservative leak prevention
- core/hakmem_super_registry.h: SUPER_MAX_PROBE 8→32
- PHASE15_WRAPPER_DOMAIN_CHECK_FIX.md: Comprehensive analysis
Root cause identified by user: LD_PRELOAD intercepts __libc_free(),
wrapper needs defense-in-depth to maintain Box boundaries.
|
2025-11-16 00:38:29 +09:00 |
|
|
|
d378ee11a0
|
Phase 15: Box BenchMeta separation + ExternalGuard debug + investigation report
- Implement Box BenchMeta pattern in bench_random_mixed.c (BENCH_META_CALLOC/FREE)
- Add enhanced debug logging to external_guard_box.h (caller tracking, FG classification)
- Document investigation in PHASE15_BUG_ANALYSIS.md
Issue: Page-aligned MIDCAND pointer not in SuperSlab registry → ExternalGuard → crash
Hypothesis: May be pre-existing SuperSlab bug (not Phase 15-specific)
Next: Test in Phase 14-C to verify
|
2025-11-15 23:00:21 +09:00 |
|
|
|
cef99b311d
|
Phase 15: Box Separation (partial) - Box headers completed, routing deferred
**Status**: Box FG V2 + ExternalGuard 実装完了、hak_free_at routing は Phase 14-C に revert
**Files Created**:
1. core/box/front_gate_v2.h (98 lines)
- Ultra-fast 1-byte header classification (TINY/POOL/MIDCAND/EXTERNAL)
- Performance: 2-5 cycles
- Same-page guard added (防御的プログラミング)
2. core/box/external_guard_box.h (146 lines)
- ENV-controlled mincore safety check
- HAKMEM_EXTERNAL_GUARD_MINCORE=0/1 (default: OFF)
- Uses __libc_free() to avoid infinite loop
**Routing**:
- hak_free_at reverted to Phase 14-C (classify_ptr-based, stable)
- Phase 15 routing caused SEGV on page-aligned pointers
**Performance**:
- Phase 14-C (mincore ON): 16.5M ops/s (stable)
- mincore: 841 calls/100K iterations
- mincore OFF: SEGV (unsafe AllocHeader deref)
**Next Steps** (deferred):
- Mid/Large/C7 registry consolidation
- AllocHeader safety validation
- ExternalGuard integration
**Recommendation**: Stick with Phase 14-C for now
- mincore overhead acceptable (~1.9ms / 100K)
- Focus on other bottlenecks (TLS SLL, SuperSlab churn)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-15 22:08:51 +09:00 |
|