_copy_from_iter_flushcache(9)
π _copy_from_iter_flushcache(9) π
okay so this is a page from the Kernel API Manual and it's genuinely the moment you've been waiting for, bestie β it's about writing to persistent memory and actually making it stick. let's get into it π«Ά
β¨ NAME β¨
_copy_from_iter_flushcache β write destination through cpu cache
like yes, the whole vibe is "write it, but flush it through the cache on the way" π«
π SYNOPSIS π
size_t _copy_from_iter_flushcache (void *addr , size_t bytes , struct
iov_iter *i );
πΈ ARGUMENTS πΈ
addrβ destination kernel address. this is where the data's going, the main character of the destination situation πbytesβ total transfer length. how much we're moving, fr friβ source iterator. the origin story, the place we're reading from π¦
π DESCRIPTION π
so the pmem driver arranges for filesystem-dax to use this facility via dax_copy_from_iter, and the whole reason is ensuring that writes to persistent memory are flushed through the CPU cache. no cap β that's the entire point. persistent memory deserves better than "idk it's probably in the cache somewhere" π
here's where it gets iconic: it's differentiated from _copy_from_iter_nocache in that it guarantees all data is flushed for all iterator types. all of them. every single one. slay. β¨
the _copy_from_iter_nocache only attempts to bypass the cache for the ITER_IOVEC case β and on some archs it may use instructions that strand dirty-data in the cache π which is, um, not the vibe we're going for. so if you need the guarantee, this is the function for you. periodt.
π₯ RETURN π₯
number of bytes copied (may be 0)
literally that's it, no dramatic twist π
π§ SEE ALSO π§
Kernel file ./lib/iov_iter.c:
_copy_mc_to_iter(9)iov_iter_folio_queue(9)iov_iter_xarray(9)iov_iter_discard(9)import_iovec(9)iov_iter_restore(9)iov_iter_extract_pages(9)iov_iter_extract_bvecs(9)
go read them, iykyk ππ
π and that's the whole page, bestie! this little gem lives in ./lib and it's dated October 2026 β so go forth, flush that cache, and remember: no dirty-data stranded in the cache on your watch. mwah ππ
π¦ 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