1.1 KiB
1.1 KiB
C7 Free Hotpath (design memo)
Goals
- Flatten the dominant C7 free path to minimise branches and helper hops.
- Keep safety checks boxed; keep hot lane minimal.
Current typical path (C7)
- size→class LUT →
class_idx = 7. - free gate / route box decides Tiny vs Pool.
- Tiny free fast v2:
- Policy/env checks,
- TLS SLL push,
- Warm/UC interaction as needed.
- Multiple helper calls along the way (gate, policy, sll push).
Target hot lane
- Single policy snapshot for C7 (warm/page/tls on).
- Straight to TLS SLL push with minimal bookkeeping.
- Optional UC/Warm stats only in sampled mode.
- Rare branches (remote/free-list edge cases) stay in boxed slow path.
Ideas to explore
- Add
hak_tiny_free_fast_v2_c7()inline used whenclass_idx==7. - Fold gate/policy reads into one branch per free call.
- Keep TLS SLL push inline, push remote/cross-thread cases behind unlikely branches.
Validation
- Compare C7-only ops/s before/after.
- Ensure remote/free-list invariants stay enforced in the slow path.