Jan Kara [off-list ref]:
quoted
Is there some other way for someone to block a page from getting evicted
from the pagecache?
We have this memfd_pin_folios() thing, but I don't think we have something
comparable for ordinary pagecache files.
... putting them into a pipe and never reading from the pipe maybe (I assume
that's what splice() does, but not sure if it actually places the pages in
there or whether it creates a copy first)?
Standard splice copies data first (it's using standard IO callbacks such as
->read_iter) so that doesn't pin page cache AFAICT. Only vmsplice(2) does
but that requires mmap.
Splice from page cache to pipe sometimes doesn't copy data.
That is why test program mentioned here may print "new":
https://lore.kernel.org/all/CAHk-=wjixHw6n_R5TQWW1r0a+GgFAPGw21KMj6obkzr3qXXbYA@mail.gmail.com/ (local)
--
Askar Safin