scx_bpf_cid_topo(9)
π scx_bpf_cid_topo(9) β bestie's guide to the kernel API manual π
okay so you're in the Kernel API Manual and the page is scx_bpf_cid_topo(9), and honestly? it's giving "copy out per-cid topology info" and nothing else. short, sweet, iconic. let's get into it β¨
πΈ NAME πΈ
scx_bpf_cid_topo β copy out per-cid topology info πΊοΈ
π SYNOPSIS π
__bpf_kfunc void scx_bpf_cid_topo (s32 cid , struct scx_cid_topo *out ,
size_t out__sz , const struct bpf_prog_aux *aux );
like literally that's the whole signature, no notes π
π¦ ARGUMENTS π¦
cidβ the cid you're looking up, bestie. that's the one.outβ where the topology info gets copied to. this is the destination, the main character π«Άout__szβ the size ofout, which is the program'ssizeof(struct scx_cid_topo). yes, exactly that, don't get cute with it.auxβ the implicit BPF argument for accessingbpf_prog_aux, and it is hidden from BPF progs π so don't come looking for it.
π§ DESCRIPTION π§
so what does it actually do? it fills out with the topology info for cid. that's the vibe check β
but β and this is important β it triggers scx_error if cid is out of range π so like, range-check your cid or perish.
if cid is valid but sits in the no-topo section, then all fields are set to -1. all of them. every single one π«
and also β all fields get set to -1 when no cid tables have been published yet, which is a thing a program may observe while racing the root enable. yes, racing. it's a whole situation ποΈπ
lowkey the coolest part: the program's struct may be older or newer than the kernel's. so what happens? the smaller ofout__szand the kernel's size gets copied, and the rest ofoutis set to-1. slay, backwards-and-forwards compatible behavior π
π SEE ALSO π
Kernel file ./kernel/sched/ext/cid.c β go read it, it's right there, bestie π
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_bpf_cpu_to_cid(9)scx_cmask_subset(9)scx_cmask_empty(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 one comes from ./kernel/sched/ext, dated October 2026, and it's filed under scx_bpf_cid_topo(9) β go off, king πβ¨ π
π¦ 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