scx_bpf_cpu_to_cid(9)
π 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 tobpf_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:
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_override(9)scx_bpf_cid_to_cpu(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 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
- 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