cbm_ensure_valid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cbm_ensure_valid β€” the kernel API manual, but make it make sense

okay bestie, pull up a chair, because we're talking about cbm_ensure_valid(9) β€” yes that's the page header, and yes I'm folding it in right here at the top like a lil name tag πŸŽ€. The manual is literally called Kernel API Manual, and the star of the show is cbm_ensure_valid, which Enforce[s] validity on provided CBM. slay.


✨ NAME ✨

cbm_ensure_valid β€” Enforce validity on provided CBM. that's it, that's the vibe check πŸ’…


🌸 SYNOPSIS 🌸

u32 cbm_ensure_valid (u32 _val , struct rdt_resource *r );

look at her. tiny. iconic. two arguments and a dream ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • _val β€” the Candidate CBM. your little hopeful bitmap, fresh out of the box, not yet judged πŸ‘€
  • r β€” the RDT resource to which the CBM belongs. every CBM needs a home, and this is hers 🏑

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea β˜•. The provided CBM represents all cache portions available for use. sounds great right? WRONG (well, not wrong, just… complicated). This may be represented by a bitmap that does not consist of contiguous ones β€” which means it's literally an invalid CBM. πŸ™ˆ not me showing up with a non-contiguous bitmap, embarrassing.

So here's what happens: the provided CBM is forced to be a valid CBM by only considering the first set of contiguous bits as valid, and clearing all bits. like, we take the first cute lil run of ones and we're like "okay bestie you're the whole personality now" and everything else gets yeeted πŸ’€.

The intention here β€” and this is the important part, iykyk β€” is to provide a valid default CBM with which a new resource group is initialized. it's giving starter-pack energy πŸ‘‘. The user can follow this with a modification to the CBM if the default does not satisfy the requirements. so like, it's a starting point, not a forever commitment. no cap 🫢


⭐ RETURN ⭐

A CBM that is valid for resource r. that's it. that's the return. she delivers πŸ’Œ


🌈 SEE ALSO 🌈

Kernel file ./fs/resctrl/rdtgroup.c, plus the whole friend group β€” because nobody functions alone, bestie:


πŸ’€ real talk though: if your CBM isn't contiguous ones, it's getting trimmed to the first contiguous set and all the other bits get cleared. that's not a bug, that's the whole point β€” but maybe don't be surprised when it happens, mmkay?

and that's the page, bestie!! πŸŽ€ sign-off time: this lil masterpiece lives in ./fs/resctrl, dated October 2026 β€” so she's from the future, obviously. periodt. πŸ’œπŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from