scx_bpf_cpu_to_cid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scx_bpf_cpu_to_cid(9) β€” like, the Kernel API Manual, bestie ✨

okay so real talk, this page lives in the scx_bpf_cpu_to_cid(9) section of the kernel API manual and it's genuinely one of the shorter ones β€” a little snack, a lil palate cleanser πŸ“


✨ NAME ✨

scx_bpf_cpu_to_cid β€” returns the cid for @cpu πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

__bpf_kfunc s32 scx_bpf_cpu_to_cid (s32 cpu , const struct bpf_prog_aux
*aux );

🌸 ARGUMENTS 🌸

  • cpu β€” the cpu you're trying to look up, that's the whole vibe πŸ’…
  • aux β€” ngl this one is the implicit BPF argument, it's what gives you access to bpf_prog_aux, and it's literally hidden from BPF progs πŸ™ˆ so don't go looking for it, it's giving backstage pass

πŸ”₯ DESCRIPTION πŸ”₯

So you call this and it returns the cid for cpu. That's it, that's the function, main character energy fr fr πŸ‘‘

But bestie, heads up: if cpu is invalid it triggers scx_error and returns -EINVAL πŸ’€ so like, vibe check your cpu first, okay?

The iconic part? The cid<->cpu mapping is static for the lifetime of the loaded scheduler β€” so the BPF side can totally cache the result and skip repeated kfunc invocations. not me saving you a syscall 😌✨


🌈 SEE ALSO 🌈

Kernel file ./kernel/sched/ext/cid.c plus the whole friend group:


🫢 and that's the whole page, periodt. this lil cutie came out of ./kernel/sched/ext and it's stamped October 2026 β€” so go forth, cache your cids, and slay πŸ’–πŸŽ€β­

πŸ“¦ where this page comes from