scx_bpf_cid_override(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 of nr_cpu_ids s32 entries, 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 be nr_cpu_ids. not "roughly", not "close enough" β€” literally nr_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 access bpf_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_CPUS cids. 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:


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