On Tue 16-01-24 14:53:00, Amir Goldstein wrote: > 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. Merged your improvement now (and I've split off the cleanup into a separate change and dropped the creation of fsnotify_path() which seemed a bit pointless with a single caller). All pushed out. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR