linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fsnotify ignored mask related fixes
@ 2022-02-23 15:14 Amir Goldstein
  2022-02-23 15:14 ` [PATCH v2 1/2] fsnotify: fix merge with parent's ignored mask Amir Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Amir Goldstein @ 2022-02-23 15:14 UTC (permalink / raw)
  To: Jan Kara; +Cc: Matthew Bobrowski, linux-fsdevel

Jan,

The two patches are functionally unrelated, but they both incorporate
information from the ignored mask into the object's interest mask.

The 1st patch is a fix for a minor functional bug.
LTP test fanotify10 has a workaround for this bug, see comment:
  /* XXX: temporary hack may be removed in the future */
The test is to remove the hack and see that fanotify10 passes.

The 2nd patch is a performance optimization that you suggested.
Last time I posted it, you asked for performance numbers [1], so I ran
some micro benchmarks (see results below [3]).

Note that the other patch from that first posting ("optimize merging of
marks with no ignored masks") did not demonstrate any visible
improvements with the benchmarks that I ran so I left it out.

The micro benchmark is a simple program [2] that writes 1 byte at a time
in a loop. I ran it on tmpfs once without any mark and once with a mark
with a mask for DELETE_SELF event.

On upstream kernel, runtime with a mark is always ~25% longer.
With the optimization patch applied, runtime with a mark is most of the
time (but not always) very close to the runtime without a mark.

[1] https://lore.kernel.org/linux-fsdevel/20201203145220.GH11854@quack2.suse.cz/
[2] https://github.com/amir73il/fsnotify-utils/blob/master/src/test/ioloop.c
[3] Performance test results:

$ time ./ioloop /tmp/foo 10000000 w
$ inotifywait -e delete_self /tmp/foo &
$ time ./ioloop /tmp/foo 10000000 w
$ rm /tmp/foo

5.17.0-rc2 #1
-------------
ioloop count=10000000 op=write

real	0m24.264s
user	0m3.977s
sys	0m20.278s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m29.914s
user	0m3.929s
sys	0m25.974s

/tmp/foo DELETE_SELF

5.17.0-rc2 #2
-------------
ioloop count=10000000 op=write

real	0m26.836s
user	0m4.212s
sys	0m22.615s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m30.206s
user	0m4.110s
sys	0m26.090s

/tmp/foo DELETE_SELF

5.17.0-rc2 #3
-------------
ioloop count=10000000 op=write

real	0m25.359s
user	0m4.386s
sys	0m20.945s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m30.213s
user	0m4.187s
sys	0m26.020s

/tmp/foo DELETE_SELF

fsnotify-ignored #1
-------------------
ioloop count=10000000 op=write

real	0m25.020s
user	0m3.982s
sys	0m21.028s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m26.084s
user	0m4.266s
sys	0m21.812s

/tmp/foo DELETE_SELF

fsnotify-ignored #2
-------------------
ioloop count=10000000 op=write

real	0m24.642s
user	0m3.945s
sys	0m20.677s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m25.790s
user	0m4.209s
sys	0m21.572s

/tmp/foo DELETE_SELF

fsnotify-ignored #3
-------------------
ioloop count=10000000 op=write

real	0m25.233s
user	0m4.315s
sys	0m20.906s

Setting up watches.
Watches established.
ioloop count=10000000 op=write

real	0m28.800s
user	0m4.329s
sys	0m24.462s

/tmp/foo DELETE_SELF

Amir Goldstein (2):
  fsnotify: fix merge with parent's ignored mask
  fsnotify: optimize FS_MODIFY events with no ignored masks

 fs/notify/fanotify/fanotify_user.c | 47 +++++++++++++++++++++---------
 fs/notify/fsnotify.c               |  8 +++--
 fs/notify/mark.c                   |  4 +--
 include/linux/fsnotify_backend.h   | 19 ++++++++++++
 4 files changed, 59 insertions(+), 19 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-24 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 15:14 [PATCH v2 0/2] Fsnotify ignored mask related fixes Amir Goldstein
2022-02-23 15:14 ` [PATCH v2 1/2] fsnotify: fix merge with parent's ignored mask Amir Goldstein
2022-02-23 15:14 ` [PATCH v2 2/2] fsnotify: optimize FS_MODIFY events with no ignored masks Amir Goldstein
2022-02-24 14:20 ` [PATCH v2 0/2] Fsnotify ignored mask related fixes Jan Kara

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).