Archived
--host-headroom-mib is a courtesy to the system: the process's unpooled allocations, the load's staging windows, the page cache. A linear-state snapshot store is not a courtesy. A store too small for one snapshot does not serve a smaller store -- it serves none, and every prefix hit re-prefills the whole conversation, while /metrics still counts the attention blocks as a hit and the request log's "(cache 0)" is the only honest number. --checkpoint-slots auto already promises a floor of kCheckpointSlotsFloor slots, but the floor was only checked against what the host had left once the host pool, the streaming mirror and the reserve had taken theirs. On a host where those fit exactly, the store resolved to 0. Charge the floor before the reserve: when the reserve is what stands between the host's spare memory and the store's floor, it gives back exactly the shortfall -- whole MiB, rounded up so the store is never a byte short, never below kHostReserveFloor (1 GiB) and never above the margin the user asked for. A host that can pin the floor gets it; a host that cannot still reports the shortfall, now naming --host-headroom-mib among the levers. The boot guard a few lines below the sizing takes the same margin, or a count auto had just fitted by giving the reserve back would be refused a moment later. The rule is bytes over the host's own measurements: checkpoint_slots_want for the count, MemAvailable, the memory cgroups and the driver's pin cap for the room. It needs no case per model or per KV encoding -- a wider slot (more linear or windowed layers), a wider streaming mirror (bf16 rather than fp8) and a larger --tp arrive as different numbers, not as different rules. Measured on 2x RX 9070 (16 GB), Qwen3.8-Flash-Next at --tp 2, bf16 KV, 2x262144, --host-pool-mib 23652: 8 snapshots of 112.73 MiB, the reserve giving back 685 MiB and holding 3.33 GiB (before: 0 snapshots, every turn re-prefilling 125-134k tokens at ttft ~31 s with "(cache 0)"). The same 6398-token prompt twice: ttft 1.66 s -> 0.65 s, cached 0 -> 5120, linear_checkpoints_written_total 0 -> 1. Tests: the rule itself (fits -> untouched, short -> exactly the shortfall, beyond it -> the 1 GiB floor, a smaller flag -> never exceeded) and checkpoint_slots_want against the counts auto already reports.