cpu_cache_in...te_memregion(9)
π cpu_cache_invalidate_memregion β drop any CPU cached data for memregion π
okay so bestie, welcome to the Kernel API Manual β¨ this one is short but it is lowkey doing a lot, and it lives in include/linux/memregion.h so you already know it's a real one π
πΈ NAME πΈ
cpu_cache_invalidate_memregion β drop any CPU cached data for memregion
Like, yeet the CPU's cached copy of a chunk of physical memory. That's the whole vibe β¨
π¦ SYNOPSIS π¦
int cpu_cache_invalidate_memregion (phys_addr_t start , size_t len );
π ARGUMENTS π
startβ the start physical address of the target memory region. where the vibe begins π«lenβ length of the target memory region. and listen,-1means all the regions of the target type, so it's giving "do the whole thing, no notes" π
π DESCRIPTION π
okay so here's the tea π β you call this to perform cache maintenance after a memory event / operation that changes the contents of physical memory in a cache-incoherent manner. like, the memory changed but the cache didn't get the memo, and now everybody's confused π
for example? device memory technologies like NVDIMM and CXL have device secure erase, and dynamic region provision that can replace the memory mapped to a given physical address. so yeah, the underlying memory can literally get swapped out from under a given physical address, and the cache needs to be told π«Ά
this functionality is limited to architectures that have an efficient way to writeback and invalidate potentially terabytes of address space at once β so if your arch can't do that efficiently, this is not the function for you, sorry bestie π
note that this routine may or may not write back any dirty contents while performing the invalidation. it's not making promises, it's just doing the invalidate part. fyi fr fr.
also important: it's only exported for the explicit usage of the NVDIMM and CXL modules in the 'DEVMEM' symbol namespace on bare platforms. so like, don't just pull this into your random driver, that's not the vibe π
Returns 0 on success or a negative error code on a failure to perform the cache maintenance. so check your return value, bestie, always π
β SEE ALSO β
- Kernel file
./include/linux/memregion.hβ go read it, iykyk π
and that's the whole page, bestie π§ source is ./include/linux, dated October 2026, and the page is cpu_cache_inv...te_memregion(9) β slay, go invalidate some caches, and remember: cache maintenance is self-care πβ¨π
π¦ 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