roadmap BUILT

231. Nothing counts how many capability slots a boot actually uses, so the wall is always a surprise

Minted the same day by calef, from milestone 230's (script/shell-check is red on main, on both architectures, and nothing says so) own BUGS. (Number provisional until the merge queue lands it.)

It was minted with no gate and needed none. What it produces is itself a check. Every boot now prints capability slots: 21 of 24 at peak, script/swish-check echoes the last such line on both architectures, and that check fails if the kernel flagged the boot as having gone past the peak recorded beside the constant.

In brief. CAPABILITY_TABLE_SLOTS has been raised three times, and every raise was reactive, after a silent failure that named something else.

Between those, the constant spent time at 28 // TEMP: generous bisection value, was restored to 17 on two true observations, and the restoration shipped a system that could not boot. That episode is milestone 230's account and is worth reading before this one is designed.

The measured high-water mark is 21, in init, during build_child for credentialer. Nobody knew that until somebody instrumented four boots to find it.

What it needs

A boot that reports the peak it reached, against the ceiling it had. That is the whole idea. A line saying the boot used 21 of 24 turns a cliff into a gauge, and it is the difference between milestone 230's four instrumented boots and one ordinary one.

Three things this block did not decide, and how they were decided.

Where the count lives: in the table, unconditionally. capability_table::CapabilityTable carries a used and a peak, and every path that can occupy an empty slot goes through one private grew(). That is rung one of AGENTS.md's ladder rather than a hook somebody has to remember at each of the kernel's seven insert sites. The lookups (get, get_with) are untouched, which is what keeps the counting off the read path.

The feature-gate question was settled by measurement rather than preference, which is what the block asked for. script/fastpath-footprint, against its 5% bound: +1.1% aarch64, +0.5% riscv64, +0.7% x86_64. Milestone 221's soak counters needed a gate at 5.7%; this does not need one, so soak and fastpath_pad's precedent is noted and not followed.

What it does as it approaches: nothing, and that is deliberate. The gauge is passive. What is checked is not the boot's distance from the ceiling but whether a recorded measurement has gone stale. kernel::cap::CAPABILITY_TABLE_PEAK_MEASURED is 21, the number milestone 230 (shell-check is red on main) found by instrumenting four boots, and a boot that goes past it prints ABOVE and fails the gate. That is the same shape as this file's size_of::<Cap>() == 32 assertion, which its own comment calls "the fact, not a target". A margin picked from one boot would have been the fourth deleted check; a fact that stopped being true is not a margin.

Whether script/swish-check asserts on it: yes, on two things. That the line is printed at all, because a gauge that quietly stopped printing is one nobody misses until the wall arrives again, which is exactly how the constant came to be raised three times reactively. And that it does not say ABOVE. It also echoes the line on success, so the number is in every CI log a person reads rather than only in a failure.

What it reports, and how one line instead of twenty-one

The kernel prints from the scheduler's idle loop (kernel::cap::report_peak), which is the one place reached after every phase of a boot with nothing else to do. The mark climbs once per grant, so the naive version printed six lines on an aarch64 boot (4, 5, 12, 14, 16, 21 of 24). Init blocks on IPC several times while building the login stack, and each pause looked like an ending. Waiting sixteen consecutive idle passes for the number to hold still reduces it to two, ending in the one that matters. That window is a coalescing constant rather than a threshold on the measurement, and getting it wrong can only cost an extra line or a later one; the peak itself never decreases.

What it measured

21 of 24, on both architectures, which is exactly the figure milestone 230 arrived at by hand. That agreement is the point: the number had been true all along and cost four instrumented boots to learn, and it now costs a boot.

It also priced milestone 233 (login dies on every boot, and the boot says it is ready) before that milestone spent anything. Handing login the two blobs it needs was expected to cost slots at the peak; the gauge says the peak after the change is still 21, because supervision_proto's fill_and_map holds one frame capability at a time. That is the whole reason these two milestones were one lane, and it is the first time this tree has been able to answer "what will this cost in slots" before merging rather than after.

Why the headroom is not the answer

Milestone 230 left three slots of margin deliberately, because both previous raises set the number to exactly what that day's boot needed and both times the next addition hit the wall in the same silence. Three slots is a guess standing in for a mechanism, and its own block says so. This milestone is what would replace it.

BUGS

Follow-on

Index row

the table counts its own peak, the boot prints capability slots: 21 of 24 at peak, and script/swish-check fails when the recorded measurement goes stale