Refactor: Split hakmem_tiny_superslab.c + unified backend exit point
Major refactoring to improve maintainability and debugging: 1. Split hakmem_tiny_superslab.c (1521 lines) into 7 focused files: - superslab_allocate.c: SuperSlab allocation/deallocation - superslab_backend.c: Backend allocation paths (legacy, shared) - superslab_ace.c: ACE (Adaptive Cache Engine) logic - superslab_slab.c: Slab initialization and bitmap management - superslab_cache.c: LRU cache and prewarm cache management - superslab_head.c: SuperSlabHead management and expansion - superslab_stats.c: Statistics tracking and debugging 2. Created hakmem_tiny_superslab_internal.h for shared declarations 3. Added superslab_return_block() as single exit point for header writing: - All backend allocations now go through this helper - Prevents bugs where headers are forgotten in some paths - Makes future debugging easier 4. Updated Makefile for new file structure 5. Added header writing to ss_legacy_backend_box.c and ss_unified_backend_box.c (though not currently linked) Note: Header corruption bug in Larson benchmark still exists. Class 1-6 allocations go through TLS refill/carve paths, not backend. Further investigation needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include "hakmem_shared_pool.h"
|
||||
#include "hakmem_tiny_config.h"
|
||||
#include "ss_allocation_box.h"
|
||||
#include "../tiny_region_id.h" // For tiny_region_id_write_header
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -109,7 +110,11 @@ void* hak_tiny_alloc_superslab_backend_shared(int class_idx)
|
||||
|
||||
hak_tiny_ss_hint_record(class_idx, ss, slab_idx);
|
||||
|
||||
#if HAKMEM_TINY_HEADER_CLASSIDX
|
||||
return tiny_region_id_write_header(base, class_idx);
|
||||
#else
|
||||
return (void*)base;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user