Files
hakmem/core/box/ss_allocation_box.h
Moe Charm (CI) 9b0d746407 Phase 3d-B: TLS Cache Merge - Unified g_tls_sll[] structure (+12-18% expected)
Merge separate g_tls_sll_head[] and g_tls_sll_count[] arrays into unified
TinyTLSSLL struct to improve L1D cache locality. Expected performance gain:
+12-18% from reducing cache line splits (2 loads → 1 load per operation).

Changes:
- core/hakmem_tiny.h: Add TinyTLSSLL type (16B aligned, head+count+pad)
- core/hakmem_tiny.c: Replace separate arrays with g_tls_sll[8]
- core/box/tls_sll_box.h: Update Box API (13 sites) for unified access
- Updated 32+ files: All g_tls_sll_head[i] → g_tls_sll[i].head
- Updated 32+ files: All g_tls_sll_count[i] → g_tls_sll[i].count
- core/hakmem_tiny_integrity.h: Unified canary guards
- core/box/integrity_box.c: Simplified canary validation
- Makefile: Added core/box/tiny_sizeclass_hist_box.o to link

Build:  PASS (10K ops sanity test)
Warnings: Only pre-existing LTO type mismatches (unrelated)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 07:32:30 +09:00

43 lines
1.4 KiB
C

// Box: Core Allocation
// Purpose: SuperSlab allocation/deallocation and slab initialization
//
// Responsibilities:
// - Allocate SuperSlab with ACE-aware sizing
// - Free SuperSlab with LRU cache integration
// - Initialize slab metadata (capacity, stride, freelist)
// - Drain remote MPSC stack to freelist
//
// Dependencies:
// - ss_os_acquire_box (OS-level mmap/munmap)
// - ss_cache_box (LRU cache + prewarm)
// - ss_stats_box (statistics)
// - ss_ace_box (ACE-aware size selection)
// - ss_slab_management_box (bitmap operations)
// - hakmem_super_registry (registry integration)
//
// API:
// - superslab_allocate() - main allocation entry
// - superslab_free() - deallocation with LRU cache
// - superslab_init_slab() - slab metadata initialization
// - _ss_remote_drain_to_freelist_unsafe() - remote drain helper
#ifndef SS_ALLOCATION_BOX_H
#define SS_ALLOCATION_BOX_H
#include "hakmem_tiny_superslab.h"
#include <stdint.h>
// SuperSlab allocation (ACE-aware)
SuperSlab* superslab_allocate(uint8_t size_class);
// SuperSlab deallocation (LRU cache integration)
void superslab_free(SuperSlab* ss);
// Slab initialization
void superslab_init_slab(SuperSlab* ss, int slab_idx, size_t block_size, uint32_t owner_tid);
// Remote drain helper (ownership already verified by caller)
void _ss_remote_drain_to_freelist_unsafe(SuperSlab* ss, int slab_idx, TinySlabMeta* meta);
#endif // SS_ALLOCATION_BOX_H