Phase v4-mid-6: Implement C6 v4 TLS Fastlist (Gated)
- Implemented TLS fastlist logic for C6 in smallobject_hotbox_v4.c (alloc/free). - Added SmallC6FastState struct and g_small_c6_fast TLS variable. - Gated the fastlist logic with HAKMEM_SMALL_HEAP_V4_FASTLIST (default OFF) due to observed instability in mixed workloads. - Fixed a memory leak in small_heap_free_fast_v4 fallback path by calling hak_pool_free. - Updated CURRENT_TASK.md with phase report.
This commit is contained in:
@ -48,6 +48,15 @@ typedef struct SmallHeapCtx {
|
||||
SmallClassHeap cls[SMALLOBJECT_NUM_CLASSES];
|
||||
} SmallHeapCtx;
|
||||
|
||||
// SmallC6FastState: TLS fastlist state for C6 (Phase v4-mid-6)
|
||||
typedef struct SmallC6FastState {
|
||||
void* freelist; // C6 fastlist head
|
||||
void* page_base; // Current C6 page base address
|
||||
uint32_t used; // Usage count (synced to page->used on switch)
|
||||
uint32_t capacity; // Page capacity
|
||||
SmallPageMeta* meta; // Back-pointer to page metadata
|
||||
} SmallC6FastState;
|
||||
|
||||
// Backward compatibility aliases (deprecated, use SmallXxx directly)
|
||||
typedef SmallPageMeta small_page_v4;
|
||||
typedef SmallClassHeap small_class_heap_v4;
|
||||
|
||||
@ -51,3 +51,17 @@ static inline int small_heap_v4_c6_enabled(void) {
|
||||
static inline int small_heap_v4_c5_enabled(void) {
|
||||
return small_heap_v4_class_enabled(5);
|
||||
}
|
||||
|
||||
static inline int small_heap_v4_fastlist_enabled(void) {
|
||||
static int g_fast = -1;
|
||||
if (__builtin_expect(g_fast == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_SMALL_HEAP_V4_FASTLIST");
|
||||
if (e && *e) {
|
||||
g_fast = (*e != '0') ? 1 : 0;
|
||||
} else {
|
||||
// Default OFF due to SEGV in random mixed
|
||||
g_fast = 0;
|
||||
}
|
||||
}
|
||||
return g_fast;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user