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)? > 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. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR