On 1/9/24 1:12 PM, Jens Axboe wrote: > On 1/9/24 12:48 PM, Amir Goldstein wrote: >> Commit e43de7f0862b ("fsnotify: optimize the case of no marks of any type") >> optimized the case where there are no fsnotify watchers on any of the >> filesystem's objects. >> >> It is quite common for a system to have a single local filesystem and >> it is quite common for the system to have some inotify watches on some >> config files or directories, so the optimization of no marks at all is >> often not in effect. >> >> Access event watchers are far less common, so optimizing the case of >> no marks with access events could improve performance for more systems, >> especially for the performance sensitive hot io path. >> >> Maintain a per-sb counter of objects that have marks with access >> events in their mask and use that counter to optimize out the call to >> fsnotify() in fsnotify access hooks. >> >> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> >> --- >> >> Jens, >> >> You may want to try if this patch improves performance for your workload >> with SECURITY=Y and FANOTIFY_ACCESS_PERMISSIONS=Y. > > Ran the usual test, and this effectively removes fsnotify from the > profiles, which (as per other email) is between 5-6% of CPU time. So I'd > say it looks mighty appealing! Tried with an IRQ based workload as well, as those are always impacted more by the fsnotify slowness. This patch removes ~8% of useless overhead in that case, so even bigger win there. -- Jens Axboe