scx_bpf_cid_topo(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 of out, which is the program's sizeof(struct scx_cid_topo). yes, exactly that, don't get cute with it.
  • aux β€” the implicit BPF argument for accessing bpf_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 of out__sz and the kernel's size gets copied, and the rest of out is 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 πŸ“–


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