scx_cmask_ref_shard(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 validated ref. 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, and out->alloc_words must already hold the shard. Like, actually. If you didn't allocate enough, that's a you problem and the universe (and scx_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:


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