From: Jan Kara <jack@suse.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>, Amir Goldstein <amir73il@gmail.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [GIT PULL] Fsnotify changes for 6.12-rc1
Date: Tue, 24 Sep 2024 11:27:57 +0200 [thread overview]
Message-ID: <20240924092757.lev6mwrmhpcoyjtu@quack3> (raw)
In-Reply-To: <CAHk-=whm4QfqzSJvBQFrCi4V5SP_iD=DN0VkxfpXaA02PKCb6Q@mail.gmail.com>
On Mon 23-09-24 12:36:14, Linus Torvalds wrote:
> On Mon, 23 Sept 2024 at 12:13, Jan Kara <jack@suse.cz> wrote:
> >
> > Sure, the details are in some of the commit messages but you're right I
> > should have summarized them in the pull request as well:
>
> So I really only looked at the parts I know - the VM side, and
> honestly, I threw up in my mouth a bit there.
>
> 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. Note that filemap_map_pages() returns VM_FAULT_NOPAGE if it has
mapped the page for the faulting address which makes the page fault code
bail out even before ->fault handler is even called.
That being said now that I'm rereading this code again, write faults will
always end up in the fault handler so we'll generate PRE_WRITE events for
them on each write fault (if someone is watching for it). Not sure if write
faults matter that much and I don't see easy way around that as that's the
promise of PRE_WRITE event...
Do the above explanations make the VM changes acceptable for you? I agree
it isn't exactly beautiful but it should work.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-09-24 9:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 11:03 [GIT PULL] Fsnotify changes for 6.12-rc1 Jan Kara
2024-09-23 18:35 ` Linus Torvalds
2024-09-23 19:13 ` Jan Kara
2024-09-23 19:36 ` Linus Torvalds
2024-09-24 9:27 ` Jan Kara [this message]
2024-09-24 16:33 ` Linus Torvalds
2024-09-25 0:16 ` Gao Xiang
2024-09-25 1:15 ` Linus Torvalds
2024-09-25 11:04 ` Jan Kara
2024-10-16 19:28 ` Josef Bacik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240924092757.lev6mwrmhpcoyjtu@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).