Hi Linus,
On 2024/9/25 00:33, Linus Torvalds wrote:
On Tue, 24 Sept 2024 at 02:28, Jan Kara <jack@xxxxxxx> wrote:
On Mon 23-09-24 12:36:14, Linus Torvalds wrote:
Do we really want to call that horrific fsnotify path for the case
where we already have the page cached? This is a fairly critical
fastpath, and not giving out page cache pages means that now you are
literally violating mmap coherency.
If the aim is to fill in caches on first access, then if we already
have a page cache page, it's by definition not first access any more!
Well, that's what actually should be happening. do_read_fault() will do
should_fault_around(vmf) -> yes -> do_fault_around() and
filemap_map_pages() will insert all pages in the page cache into the page
table page before we even get to filemap_fault() calling our fsnotify
hooks.
That's the fault-around code, yes, and it will populate most pages on
many filesystems, but it's still optional.
Not all filesystems have a 'map_pages' function at all (from a quick
grep at least ceph, erofs, ext2, ocfs2 - although I didn't actually
validate that my quick grep was right).
Just side note: I think `generic_file_vm_ops` already prepares this
feature, so generic_file_mmap users also have fault around behaviors.
Anyway..
Thanks,
Gao Xiang