Phase 12: SP-SLOT Box data structures (Task SP-1)

Added per-slot state management for Shared SuperSlab Pool optimization.

Problem:
- Current: 1 SuperSlab mixes multiple classes (C0-C7)
- SuperSlab freed only when ALL classes empty (active_slabs==0)
- Result: SuperSlabs rarely freed, LRU cache unused

Solution: SP-SLOT Box
- Track each slab slot state: UNUSED/ACTIVE/EMPTY
- Per-class free slot lists for efficient reuse
- Free SuperSlab only when ALL slots empty

New Structures:
1. SlotState enum - Per-slot state (UNUSED/ACTIVE/EMPTY)
2. SharedSlot - Per-slot metadata (state, class_idx, slab_idx)
3. SharedSSMeta - Per-SuperSlab slot array management
4. FreeSlotList - Per-class free slot lists

Extended SharedSuperSlabPool:
- free_slots[TINY_NUM_CLASSES_SS] - Per-class lists
- ss_metadata[] - SuperSlab metadata array

Next Steps:
- Task SP-2: Implement 3-stage acquire_slab logic
- Task SP-3: Convert release_slab to slot-based
- Expected: Significant mmap/munmap reduction

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-14 07:59:33 +09:00
parent dd613bc93a
commit 9830237d56
2 changed files with 71 additions and 1 deletions

View File

@ -25,7 +25,12 @@ SharedSuperSlabPool g_shared_pool = {
.class_hints = { NULL },
.lru_head = NULL,
.lru_tail = NULL,
.lru_count = 0
.lru_count = 0,
// Phase 12: SP-SLOT fields
.free_slots = {{.entries = {{0}}, .count = 0}}, // Zero-init all class free lists
.ss_metadata = NULL,
.ss_meta_capacity = 0,
.ss_meta_count = 0
};
static void