clean_cache_range(9)
π clean_cache_range(9) π
okay so bestie, this one's a lil kernel API page from the Kernel API Manual, section 9 β the deep magic zone π§β¨. it's called clean_cache_range and it is literally the "bestie, please flush your cache" of the x86 world. ngl, it's a short one, so we're gonna get through it together, mwah π
πΈ NAME πΈ
clean_cache_range β write back a cache range with CLWB. that's it. that's the whole vibe. π«Ά
β¨ SYNOPSIS β¨
void clean_cache_range (void *addr , size_t size );
copy it exactly like that, spacing and all β no cap, do not "fix" the spaces, the manpage said what it said π
π¦ ARGUMENTS π¦
addrβ the virtual start address. like, where the party begins πsizeβ number of bytes to write back. how much of the party we're cleaning up after π§Ή
π DESCRIPTION π
so what does it actually do? it writes back a cache range using the CLWB (cache line write back) instruction. iconic. that's the whole job, and it does it well π
and here's the lil detail you cannot skip, bestie β size is internally rounded up to be cache line size aligned. so if you hand it a number that isn't cache-line-sized, it's not gonna be messy about it, it just rounds up for you. lowkey thoughtful of it ngl π
heads up: because of that rounding, the function may be working with a slightly bigger range than the size you actually passed in. that's the documented behaviour, so don't come for me, i'm just the messenger π
π SEE ALSO π
- Kernel file
./arch/x86/lib/usercopy_64.cβ go read the source, iykyk πβ¨
and that's the whole page! π short, sweet, slays. this one comes to you from ./arch/x86/lib and it's dated October 2026 β so remember that era, bestie, and go write back some cache lines ππ₯π
π¦ 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