scx_cmask_ref_shard(9)
π scx_cmask_ref_shard(9) β the one from the Kernel API Manual, bestie
Okay so bestie, listen. This is a page out of the Kernel API Manual, and it's about scx_cmask_ref_shard β literally just "read one little shard out of @ref and drop it into @out", and honestly? Iconic. Lowkey doing the most with the least. Let's get into it π
β¨ NAME β¨
scx_cmask_ref_shard β Read one shard from @ref into @out. That's it, that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
void scx_cmask_ref_shard (const struct scx_cmask_ref *ref , s32
shard_idx , struct scx_cmask *out );
Yeah she's a void, she takes three args, she does not return anything, she simply exists and does her job. Main character energy, no notes. π
π«Ά ARGUMENTS π«Ά
refβ a validatedref. Emphasis on validated, bestie, this is not the place to be handing over your little unvetted situationship of a pointer πshard_idxβ the target shard, and it has to live in[ref->shard_first, ref->shard_end). Note that half-open interval, the closing bracket is doing real work there πoutβ your output cmask, andout->alloc_wordsmust already hold the shard. Like, actually. If you didn't allocate enough, that's a you problem and the universe (andscx_errors) will let you know π
π DESCRIPTION π
So what she actually does: she sets out to the intersection of ref's range with shard_idx's cid range, and the bits[] get read from ref->src via READ_ONCE. Very demure, very mindful, very concurrency-aware of her β
If the intersection comes out empty? Chill. She just sets out->nr_cids to 0. No drama, no crash, just a cute little zero πΈ
BUT β and this is the part where you pay attention, bestie β if out can't hold the shard, she calls scx_errors on ref's sched. So please, for the love of everything, size your out right the first time π
π₯ SEE ALSO π₯
The whole friend group, fr fr β plus the kernel file they all live in:
Kernel file ./kernel/sched/ext/cid.c:
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_bpf_cid_topo(9)scx_cmask_ref_init(9)scx_cmask_ref_init_kern(9)scx_cmask_ref_or(9)scx_cmask_ref_copy(9)scx_cmask_ref_from_cpumask(9)
ngl bestie, if you're reading this page you're probably already deep in the cmask ref lore. Go read the rest of them, iykyk π§
And that's a wrap, babe π β this lil transmission came to you from ./kernel/sched/ext, dated October 2026, and yes she is still scx_cmask_ref_shard(9). Slay, stay hydrated, allocate your out properly πβ¨
π¦ 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