_copy_from_iter_flushcache(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… _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 fr
  • i β€” 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:

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