Restore C7 Warm/TLS carve for release and add policy scaffolding
This commit is contained in:
@ -87,16 +87,6 @@ static inline SuperSlab* tiny_warm_pool_pop(int class_idx) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// O(1) push to warm pool
|
||||
// Returns: 1 if pushed successfully, 0 if pool full (caller should free to LRU)
|
||||
static inline int tiny_warm_pool_push(int class_idx, SuperSlab* ss) {
|
||||
if (g_tiny_warm_pool[class_idx].count < TINY_WARM_POOL_MAX_PER_CLASS) {
|
||||
g_tiny_warm_pool[class_idx].slabs[g_tiny_warm_pool[class_idx].count++] = ss;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get current count (for metrics/debugging)
|
||||
static inline int tiny_warm_pool_count(int class_idx) {
|
||||
return g_tiny_warm_pool[class_idx].count;
|
||||
@ -125,14 +115,35 @@ static inline int warm_pool_max_per_class(void) {
|
||||
return g_max;
|
||||
}
|
||||
|
||||
// Push with environment-configured capacity
|
||||
static inline int tiny_warm_pool_push_tunable(int class_idx, SuperSlab* ss) {
|
||||
int capacity = warm_pool_max_per_class();
|
||||
if (g_tiny_warm_pool[class_idx].count < capacity) {
|
||||
// O(1) push to warm pool (cap-aware)
|
||||
// cap_hint <=0 → use warm_pool_max_per_class() clamped to TINY_WARM_POOL_MAX_PER_CLASS
|
||||
static inline int tiny_warm_pool_push_with_cap(int class_idx, SuperSlab* ss, int cap_hint) {
|
||||
int limit = cap_hint;
|
||||
if (limit <= 0 || limit > TINY_WARM_POOL_MAX_PER_CLASS) {
|
||||
limit = warm_pool_max_per_class();
|
||||
if (limit <= 0) {
|
||||
limit = TINY_WARM_POOL_MAX_PER_CLASS;
|
||||
}
|
||||
if (limit > TINY_WARM_POOL_MAX_PER_CLASS) {
|
||||
limit = TINY_WARM_POOL_MAX_PER_CLASS;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_tiny_warm_pool[class_idx].count < limit) {
|
||||
g_tiny_warm_pool[class_idx].slabs[g_tiny_warm_pool[class_idx].count++] = ss;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Default push (uses ENV/default cap)
|
||||
static inline int tiny_warm_pool_push(int class_idx, SuperSlab* ss) {
|
||||
return tiny_warm_pool_push_with_cap(class_idx, ss, -1);
|
||||
}
|
||||
|
||||
// Push with environment-configured capacity (legacy name)
|
||||
static inline int tiny_warm_pool_push_tunable(int class_idx, SuperSlab* ss) {
|
||||
return tiny_warm_pool_push_with_cap(class_idx, ss, warm_pool_max_per_class());
|
||||
}
|
||||
|
||||
#endif // HAK_TINY_WARM_POOL_H
|
||||
|
||||
Reference in New Issue
Block a user