cmask_from_cpumask(9)
π cmask_from_cpumask β the Kernel API Manual page, bestie edition π
okay so this is cmask_from_cpumask(9) from the Kernel API Manual, and honestly? she's a tiny little translator and she slays at her one job. let's get into it β¨
πΈ NAME πΈ
cmask_from_cpumask β translate a kernel cpumask to a cid-space cmask, no cap π¦
β¨ SYNOPSIS β¨
void cmask_from_cpumask (struct scx_cmask __arena *m , const struct
cpumask *cpumask );
look at her. two args, no return, zero drama. iconic. π
π ARGUMENTS π
mβ the cmask to fill, bestie. it gets zeroed first, and then only bits within[m->base, m->base + m->nr_cids)get updated. so if a cpu maps to a cid outside that range? it's getting ignored, sorry not sorry πcpumaskβ the kernel cpumask to translate. that's it, that's the whole vibe π«Ά
π DESCRIPTION π
so for each cpu in cpumask, it sets that cpu's cid in m. literally that's the whole thing. simple, clean, ate. π₯
β οΈ but the tea is: the caller must ensurecpumaskstays stable across the call β like, for example, holding an RCU read lock fortask->cpus_ptr. do not let that thing shift under you mid-call, i am begging π
π SEE ALSO π
- Kernel file
./tools/sched_ext/include/scx/cid.bpf.h __cmask_init(9)cmask_init(9)cmask_reframe(9)cmask_next_set(9)
go read them, they're the friend group, you can't just know one of them π
kay that's the page!! source is ./tools/sched_ext/include/scx and this was dated October 2026 β mwah, bye bestie, go translate some cpumasks π
π§ββοΈβ
π¦ 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