Fix report: P0 batch refill active counter bug documented; add flow diagram and patch excerpt; CLAUDE phase 6-2.3 notes; CURRENT_TASK updated with root cause, fix, and open items.
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
--- a/core/hakmem_tiny_refill_p0.inc.h
|
||||
+++ b/core/hakmem_tiny_refill_p0.inc.h
|
||||
@@ -99,9 +99,10 @@ static inline int sll_refill_batch_from_ss(int class_idx, int max_take) {
|
||||
uint32_t from_freelist = trc_pop_from_freelist(meta, want, &chain);
|
||||
if (from_freelist > 0) {
|
||||
trc_splice_to_sll(class_idx, &chain, &g_tls_sll_head[class_idx], &g_tls_sll_count[class_idx]);
|
||||
- // NOTE: from_freelist は既に used/active 計上済みのブロックの再循環。active 追加や
|
||||
- // nonempty_mask クリアは不要(クリアすると後続freeで立たない)。
|
||||
+ // FIX (2025-11-07): Blocks from freelist were decremented when freed (remote or local).
|
||||
+ // Must increment counter when moving back to allocation pool (TLS SLL).
|
||||
+ // Bug: Without this, counter underflows → false OOM → crash.
|
||||
+ ss_active_add(tls->ss, from_freelist);
|
||||
extern unsigned long long g_rf_freelist_items[];
|
||||
g_rf_freelist_items[class_idx] += from_freelist;
|
||||
total_taken += from_freelist;
|
||||
@@
|
||||
TinyRefillChain chain;
|
||||
uint32_t from_freelist = trc_pop_from_freelist(meta, want, &chain);
|
||||
if (from_freelist > 0) {
|
||||
trc_splice_to_sll(class_idx, &chain, &g_tls_sll_head[class_idx], &g_tls_sll_count[class_idx]);
|
||||
// FIX: Blocks from freelist were decremented when freed, must increment when allocated
|
||||
ss_active_add(tls->ss, from_freelist);
|
||||
extern unsigned long long g_rf_freelist_items[];
|
||||
g_rf_freelist_items[class_idx] += from_freelist;
|
||||
total_taken += from_freelist;
|
||||
want -= from_freelist;
|
||||
if (want == 0) break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user