linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>,
	Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3] fsnotify: optimize the case of no parent watcher
Date: Tue, 16 Jan 2024 14:53:00 +0200	[thread overview]
Message-ID: <CAOQ4uxjioTjpxueE8OF_SjgqknDAsDVmCbG6BSmGLB_kqXRLmg@mail.gmail.com> (raw)
In-Reply-To: <20240116120434.gsdg7lhb4pkcppfk@quack3>

On Tue, Jan 16, 2024 at 2:04 PM Jan Kara <jack@suse.cz> wrote:
>
> On Tue 16-01-24 13:32:47, Amir Goldstein wrote:
> > If parent inode is not watching, check for the event in masks of
> > sb/mount/inode masks early to optimize out most of the code in
> > __fsnotify_parent() and avoid calling fsnotify().
> >
> > Jens has reported that this optimization improves BW and IOPS in an
> > io_uring benchmark by more than 10% and reduces perf reported CPU usage.
> >
> > before:
> >
> > +    4.51%  io_uring  [kernel.vmlinux]  [k] fsnotify
> > +    3.67%  io_uring  [kernel.vmlinux]  [k] __fsnotify_parent
> >
> > after:
> >
> > +    2.37%  io_uring  [kernel.vmlinux]  [k] __fsnotify_parent
> >
> > Reported-and-tested-by: Jens Axboe <axboe@kernel.dk>
> > Link: https://lore.kernel.org/linux-fsdevel/b45bd8ff-5654-4e67-90a6-aad5e6759e0b@kernel.dk/
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> > ---
> >
> > Jan,
> >
> > Considering that this change looks like a clear win and it actually
> > the change that you suggested, I cleaned it up a bit and posting for
> > your consideration.
>
> Agreed, I like this. What did you generate this patch against? It does not
> apply on top of current Linus' tree (maybe it needs the change sitting in
> VFS tree - which is fine I can wait until that gets merged)?
>

Yes, it is on top of Christian's vfs-fixes branch.

> > I've kept the wrappers fsnotify_path() and fsnotify_sb_has_watchers()
> > although they are not directly related to the optimization, because they
> > makes the code a bit nicer IMO.
>
> Yeah, these cleanups are fine. I would have prefered them as a separate
> patch (some people might want the performance improvement to be backported
> and this makes it unnecessarily more complex) but don't resend just because
> of that.
>

Makes sense.

Thanks,
Amir.

  reply	other threads:[~2024-01-16 12:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 11:32 [PATCH v3] fsnotify: optimize the case of no parent watcher Amir Goldstein
2024-01-16 12:04 ` Jan Kara
2024-01-16 12:53   ` Amir Goldstein [this message]
2024-01-24 16:07     ` Jan Kara
2024-01-24 16:20       ` Amir Goldstein
2024-02-13 19:45         ` Amir Goldstein
2024-02-14 11:23           ` Jan Kara
2024-02-14 13:40             ` Amir Goldstein
2024-02-15  8:36               ` Jan Kara
2024-03-06 14:51                 ` Amir Goldstein
2024-03-08 16:00                   ` Jan Kara
2024-03-11 13:51                     ` Christian Brauner
2024-02-15 15:07           ` Jens Axboe

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=CAOQ4uxjioTjpxueE8OF_SjgqknDAsDVmCbG6BSmGLB_kqXRLmg@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.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).