Phase 3d-C: Hot/Cold Slab Split - SuperSlab cache locality optimization (baseline established)
Goal: Improve L1D cache hit rate via hot/cold slab separation Implementation: - Added hot/cold fields to SuperSlab (superslab_types.h) - hot_indices[16] / cold_indices[16]: Index arrays for hot/cold slabs - hot_count / cold_count: Number of slabs in each category - Created ss_hot_cold_box.h: Hot/Cold Split Box API - ss_is_slab_hot(): Utilization-based hot判定 (>50% usage) - ss_update_hot_cold_indices(): Rebuild index arrays on slab activation - ss_init_hot_cold(): Initialize fields on SuperSlab creation - Updated hakmem_tiny_superslab.c: - Initialize hot/cold fields in superslab creation (line 786-792) - Update hot/cold indices on slab activation (line 1130) - Include ss_hot_cold_box.h (line 7) Architecture: - Strategy: Hot slabs (high utilization) prioritized for allocation - Expected: +8-12% from improved cache line locality - Note: Refill path optimization (hot優先スキャン) deferred to future commit Testing: - Build: Success (LTO warnings are pre-existing) - 10K ops sanity test: PASS (1.4M ops/s) - Baseline established for Phase C-8 benchmark comparison Phase 3d sequence: - Phase A: SlabMeta Box boundary (38552c3f3) ✅ - Phase B: TLS Cache Merge (9b0d74640) ✅ - Phase C: Hot/Cold Split (current) ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
// Date: 2025-10-24
|
||||
|
||||
#include "hakmem_tiny_superslab.h"
|
||||
#include "box/ss_hot_cold_box.h" // Phase 3d-C: Hot/Cold Split
|
||||
#include "hakmem_super_registry.h" // Phase 1: Registry integration
|
||||
#include "hakmem_tiny.h" // For tiny_self_u32
|
||||
#include "hakmem_tiny_config.h" // For extern g_tiny_class_sizes
|
||||
@ -783,6 +784,14 @@ SuperSlab* superslab_allocate(uint8_t size_class) {
|
||||
ss->lru_prev = NULL;
|
||||
ss->lru_next = NULL;
|
||||
|
||||
// Phase 3d-C: Initialize Hot/Cold Split fields
|
||||
ss->hot_count = 0;
|
||||
ss->cold_count = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ss->hot_indices[i] = 0;
|
||||
ss->cold_indices[i] = 0;
|
||||
}
|
||||
|
||||
// Initialize all slab metadata (only up to max slabs for this size)
|
||||
int max_slabs = (int)(ss_size / SLAB_SIZE);
|
||||
|
||||
@ -1116,6 +1125,9 @@ void superslab_activate_slab(SuperSlab* ss, int slab_idx) {
|
||||
if ((ss->slab_bitmap & mask) == 0) {
|
||||
ss->slab_bitmap |= mask;
|
||||
ss->active_slabs++;
|
||||
|
||||
// Phase 3d-C: Update hot/cold indices after activating new slab
|
||||
ss_update_hot_cold_indices(ss);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user