scx_bpf_cid_override(9)
π scx_bpf_cid_override(9) β the Kernel API Manual glow-up
okay so bestie, welcome to the scx_bpf_cid_override(9) page, straight out of the Kernel API Manual β¨ this one's a kfunc, it lives in the scheduler-extension world, and it's giving "I am the main character of cpuβcid mapping" energy π
πΈ NAME πΈ
scx_bpf_cid_override β install an explicit cpu->cid mapping, and like, bring your own shard info too π
β¨ SYNOPSIS β¨
__bpf_kfunc void scx_bpf_cid_override (const s32 *cpu_to_cid__arena ,
u32 cpu_to_cid_cnt , const s32 *shard_start__arena , u32 shard_start_cnt
, const struct bpf_prog_aux *aux );
π ARGUMENTS π
cpu_to_cid__arenaβ an array ofnr_cpu_idss32entries, i.e. the cid for each cpu. one entry per cpu, no skipping, iykyk π«Άcpu_to_cid_cntβ how many entries you're passing. and it must benr_cpu_ids. not "roughly", not "close enough" β literallynr_cpu_idsπshard_start__arenaβ array of the first-cid-of-each-shard, one entry per shard. the shard starts, the shard beginnings, the shard origin stories πshard_start_cntβ the number of shards π¦auxβ the implicit BPF argument used to accessbpf_prog_aux, hidden from BPF progs π (she's shy, she's internal, she's not for you)
π₯ DESCRIPTION π₯
Okay so here's the vibe check: this may only be called from ops.init_cids of the root scheduler. that's the rule, that's the assignment, periodt π
What she does is replace the topology-probed cid mapping and shard layout with the ones you provide. no cap, you're overriding the whole thing β¨
Now the rules, and bestie, they are strict:
- Every possible cpu must map to a unique cid in
[0, num_possible_cpus). - The shard starts must be strictly increasing, with the first entry
0, and all values< num_possible_cpus. - The last shard extends to
num_possible_cpus. - No shard may span more than
SCX_CID_SHARD_MAX_CPUScids. that's the ceiling, don't test her π
Topo info (core/LLC/node) gets cleared, and the shard layout is set from the input.
β οΈ literally the most important part: on invalid input, the scheduler gets aborted. not warned, not gently nudged β aborted π so double-check your arrays before you send them, fr fr.
π¦ SEE ALSO π¦
Kernel file ./kernel/sched/ext/cid.c, plus her whole friend group:
scx_cid_publish_tables(9)scx_cid_retire_tables(9)scx_cid_init(9)scx_cmask_clear(9)scx_cmask_fill(9)scx_bpf_cid_to_cpu(9)scx_bpf_cpu_to_cid(9)scx_cmask_subset(9)scx_cmask_empty(9)scx_bpf_cid_topo(9)scx_cmask_ref_init(9)scx_cmask_ref_init_kern(9)scx_cmask_ref_shard(9)scx_cmask_ref_or(9)scx_cmask_ref_copy(9)scx_cmask_ref_from_cpumask(9)
and that's the page!! π this little beauty ships with ./kernel/sched/ext and is dated October 2026 β so like, mark your calendar, screenshot it, put it on the fridge πΈ mwah, go slay your cid mapping bestie π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms