cid_valid(9)
β¨ cid_valid(9) β¨
okay so bestie, welcome to the cid_valid(9) page β that's the kernel API manual, and yes we're gonna read it together, it's short and it's iconic π
π NAME π
cid_valid β verify a cid value, to be used on ops input args. that's literally the whole job description and she does it well π«Ά
πΈ SYNOPSIS πΈ
bool cid_valid (struct scx_sched *sch , s32 cid );
π ARGUMENTS π
schβ thescx_schedthat gets aborted on error π like, if things go bad, this is the one catching the fallout.cidβ thecidwhich came from a BPF ops β¨ it's giving "value from the outside world", so of course we gotta check it.
π¦ DESCRIPTION π¦
so here's the tea β β this function returns true if cid is in [0, num_possible_cpus) π that's the sweet spot, that's the range, that's where we want her to be.
on failure? it triggers scx_error and returns false π no cap, that's the whole flow. validate, and if it doesn't vibe check out, error out and say no.
π SEE ALSO π
kernel file ./kernel/sched/ext/cid.h β and the whole friend group:
__scx_cid_to_cpu(9)__scx_cpu_to_cid(9)scx_cid_to_cpu(9)scx_cpu_to_cid(9)scx_is_cid_type(9)__scx_cmask_init(9)scx_cmask_init(9)scx_cmask_reframe(9)scx_cmask_test(9)scx_cmask_for_each_cid(9)
ngl bestie, if you're out here passing a cid from a BPF ops without checking it first, this page is your sign π«Ά use the validator, protect your scheduler, periodt π
and that's the page!! sign-off time π this one lives in ./kernel/sched/ext, dated October 2026 β mwah, go forth and validate responsibly, iykyk π§π
π¦ 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