Fix Larson 36x slowdown: Remove tls_uninitialized early return in sll_refill_small_from_ss()

Problem:
- Larson benchmark showed 730K ops/s instead of expected 26M ops/s
- Class 1 TLS SLL cache always stayed empty (tls_count=0)
- All allocations went through slow path (shared_pool_acquire_slab at 48% CPU)

Root cause:
- In sll_refill_small_from_ss(), when TLS was completely uninitialized
  (ss=NULL, meta=NULL, slab_base=NULL), the function returned 0 immediately
  without calling superslab_refill() to initialize it
- The comment said "expect upper logic to call superslab_refill" but
  tiny_alloc_fast_refill() did NOT call it after receiving 0
- This created a loop: TLS SLL stays empty → refill returns 0 → slow path

Fix:
- Remove the tls_uninitialized early return
- Let the existing downstream condition (!tls->ss || !tls->meta || ...)
  handle the uninitialized case and call superslab_refill()

Result:
- Throughput: 730K → 26.5M ops/s (36x improvement)
- shared_pool_acquire_slab: 48% → 0% in perf profile

Introduced in: fcf098857 (Phase12 debug, 2025-11-14)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-27 16:47:30 +09:00
parent b72519311a
commit 930c5283b4

View File

@ -274,15 +274,9 @@ int sll_refill_small_from_ss(int class_idx, int max_take)
return 0;
}
bool tls_uninitialized =
(tls->ss == NULL) &&
(tls->meta == NULL) &&
(tls->slab_base == NULL);
if (tls_uninitialized) {
// 初回は、呼び出し元の上位ロジックが superslab_refill を呼ぶことを期待し、ここでは何もしない。
return 0;
}
// FIX: TLS未初期化時も superslab_refill() で初期化する(早期リターン削除)
// 以前は tls_uninitialized の場合に return 0 していたが、これだと
// TLS SLL が永遠に空のままになり、Larson ベンチで 70x slowdown が発生していた。
// Ensure we have a valid TLS slab for this class via shared pool.
// superslab_refill() 契約: