Per-LLC idle-word masks and the LLC each mode prefers: the die with the most
high-capacity cores, else the largest cache under mode βcacheβ, else the
highest summed platform preference. Multi-LLC hosts within one word only.
Live IRQ-sink tracking riding the 1 s run loop. Each window the handler-time
deltas are split at their widest gap; a CPU above the cut for FLAG_POLLS
windows is published, released after UNFLAG_POLLS below it (a loading screen
must not flap the mask). An unchanged set doubles the interval up to
INTERVAL_MAX; a disagreeing window resets to tick rate. All four are counts.
Every construct toggle: name, construct, BPF default. The default is
checked against the compiled rodata at start so the two cannot drift;
βhelp prints this table.
The tick period from the coarse clockβs resolution, which the kernel sets
to one jiffy. 0 when the resolution is not a plausible tick (a VM or an
odd clocksource): the precise task-age clock is used instead.
Drop the calling threadβs capability sets and restore process inspection.
Call after privileged setup. Earlier-created threads retain their own
capabilities; a subsequent privileged initialization requires re-exec.
Parse the command line, dropping options cake does not have instead of
refusing to start (a legacy scx_loader flag must not keep the scheduler
off); dropped tokens are reported once logging is up. Real errors keep clapβs.
Measure one wake + block + switch hop on THIS host: two threads ping-pong
through a condvar, the blocking handoff cake_handoff_max_ns is a proxy
for. Runs before attach, so it measures the stock kernel path; ~2200 round
trips. Returns ns per one-way hop, or None, and callers keep the defaults.
Per-CPU time spent in interrupt handlers, in kernel ticks, from
/proc/stat (irq + softirq columns, CONFIG_IRQ_TIME_ACCOUNTING). Handler
TIME is the harm itself: a wake suffers when it lands on a running handler,
so line counts mis-price it; softirq is included because NAPI shadows wakes.
The CPUs /proc/stat reported in both reads, and their handler-time
deltas in that order. Only those are ranked: a possible-but-offline id has
no handler time and would push the whole online set above the widest gap.
Split the hostβs handler-time distribution at its widest gap: sinks are the
CPUs above the cut. No unit-carrying threshold, so it adapts to any host. A
zero delta enters at half a tick so every ratio stays finite. A flat set has
no sinks; a cut condemning half the machine is load, not affinity (None).