roadmap BUILT

761. Capability lookup off the global lock

(Title and slug are drafts.) needs_person is yes only because the result is taken at radon's bench.

Index row

The cheapest system call stops taking the kernel's one global lock: each thread's capability table gets its own lock, so a lookup contends with nobody. Fatal risk 4's open finding is the null system call costing 147 ticks a job at four busy cores on radon against 99 at one. 41% of its lookups found IPC_TABLES held. This is the change that finding pointed at. On radon (2026-10-05) the lookups that wait fell to 0.05% and the job's rise from one task to four from 48 ticks to 10.

Why

Every system call that names a capability starts in sched::current_cap, which took IPC_TABLES, the kernel's one global lock, to read the calling thread's own table. On radon at four busy tasks 41% of those lookups found the lock held, and the null system call cost 147 ticks a job against 99 at one task (notes/job-mix/null-system-call-under-load.md). A capability table has exactly one owner thread; it shared the global lock only because it was a field of the thread table's entries. This is fatal risk 4's open finding.

What was built

No system call semantics, ABI or wire format changed. Names CAPABILITY_TABLE (rank), CapabilityTableLock, capability_table_of, init_capability_table, CURRENT_CAPABILITIES, set_current, current_capabilities, lock_found, deliver_capability, get_mut_with_capabilities, iter_mut_with_capabilities and capabilities are provisional.

What QEMU said

riscv64 TCG, script/job-mix --arch riscv64 --smp 4 --release --lock-wait, two runs each side, interleaved on the same host:

At 4 tasks before after
current_cap calls that found their lock held 92,286 and 99,195 of 480,000 (19 to 21%) 17 and 25
IPC_TABLES contended acquisitions 361,138 and 392,402 259,777 and 269,260 (down 29%)
rank 57 (capability_table) contended (no such lock) 30 and 42

The counts are the result TCG can give. Its ticks cannot: the host carried other lanes' builds, and null_system_call at four tasks read 1,066 to 1,861 across six runs a side with no separation, which is the null-system-call note's own caveat. The size of the win is radon's to say.

Gates

What radon said

2026-10-05 (UTC), by a run sheet written before any boot (bench/radon-2026-10-05/ (nifeos/nife:bench/radon-2026-10-05/README.md), read in full in the appendix). Built from c8b5fd09e, which also carries milestone 766 (each core's PerCpu on its own cache line). At four tasks:

2026-10-04 2026-10-05
current_cap calls that found their lock held (lock_wait boots) 41.4%, 41.8% 0.048%, 0.049%
IPC_TABLES wait (lock_wait boots) 2,593,130 ticks 1,241,793 and 1,278,777
null_system_call per_job, 1 / 4 tasks (three boots) 99 / 147 110 / 120
growth from 1 task to 4 48 10

By the pre-written bands, 120 reads PARTIAL and the one-task guard failed (110, above 101). The guard's rise is code placement, not this milestone: a rebuild of the old commit read 99 again, and shifting main's text alone moved one task from 110 to 118. Growth with cores held within a tick across those layouts, and it is what fell. This milestone is done; what remains of the rise, about 5 ticks a job, is not a lock.

BUGS

Follow-on