Re: [PATCH v3] fsnotify: optimize the case of no parent watcher

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 16, 2024 at 2:04 PM Jan Kara <jack@xxxxxxx> 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@xxxxxxxxx>
> > Link: https://lore.kernel.org/linux-fsdevel/b45bd8ff-5654-4e67-90a6-aad5e6759e0b@xxxxxxxxx/
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> > ---
> >
> > 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.





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux