From: Jan Kara <jack@suse.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>, 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: Wed, 25 Sep 2024 13:04:54 +0200 [thread overview]
Message-ID: <20240925110454.ao2kcpfqba6uygnc@quack3> (raw)
In-Reply-To: <CAHk-=wijqCH+9HUkOgwT_f1o4Tp05ACQUFG9YrxLpOVdRoCwpw@mail.gmail.com>
On Tue 24-09-24 18:15:51, Linus Torvalds wrote:
> On Tue, 24 Sept 2024 at 17:17, Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> >
> > Just side note: I think `generic_file_vm_ops` already prepares this
> > feature, so generic_file_mmap users also have fault around behaviors.
>
> Hmm. Maybe. But it doesn't really change the fundamental issue - the
> code in question seems to be just *random*.
>
> And I mean that in a very real and very immediate sense: the
> fault-around code and filemap_map_pages() only maps in pages that are
> uptodate, so it literally DEPENDS ON TIMING whether some previous IO
> has completed or not, and thus on whether the page fault is handled by
> the fault-around in filemap_map_pages() or by the filemap_fault()
> code.
>
> In other words - I think this is all completely broken.
>
> Put another way: explain to me why random IO timing details should
> matter for the whether we do __filemap_fsnotify_fault() on a page
> fault or not?
I agree that with the fault-around code, there's dependency on IO
completion time. So we can still be generating PRE_ACCESS events while the
data is being loaded from the disk. This was a compromise we ended up with
after quite some discussions about possible solutions. Generally the
options I see for page faults are:
1) Generate PRE_ACCESS event whenever a page is being mapped into page
tables (in fact Josef originally had this in his patch). This would
provide the determinism at the cost of performance (events generated even
for cached pages). If this is OK with you, we can do that but from what I
gather from your previous emails you don't really like this either.
2) We could generate event in filemap_fault() only if we don't find
uptodate folio there. I'm happy to do this if it looks better to you
although I don't think there's a practical difference from the current
state (the same raciness with IO completion applies, just the window is
smaller).
3) We could generate event in filemap_fault() only if we didn't find a
folio in the page cache or we found it, locked it, but it still was not
uptodate. This will make sure we generate the event only if we really need
to pull in the data into the page cache. Doable. The case when we found &
locked a page that's not uptodate in the end will be a bit ugly but not too
bad and this case should be rare. I actually like this option the most I
guess.
> So no. I'm not taking this pull request. It makes absolutely zero
> sense to me, and I don't think it has sane semantics. The argument
> that it is already used by people is not an argument.
I mentioned that to show that there's practical interest in this kind of
functionality. I think people involved understand things are pretty much in
flux until they are merged upstream.
> The new fsnotify hooks need to make SENSE - not be in random locations
> that give some kind of random data.
Thanks for feedback. So 1) and 3) from the above options make sense to me
(in the sense that it is relatively easy to explain when events are
generated). I'd prefer 3) for performance reasons so can we settle on that?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-09-25 11:05 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
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 [this message]
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=20240925110454.ao2kcpfqba6uygnc@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=hsiangkao@linux.alibaba.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).