linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Bobrowski <mbobrowski@mbobrowski.org>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 0/2] Fsnotify ignored mask related fixes
Date: Wed, 23 Feb 2022 17:14:36 +0200	[thread overview]
Message-ID: <20220223151438.790268-1-amir73il@gmail.com> (raw)

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


             reply	other threads:[~2022-02-23 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 15:14 Amir Goldstein [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220223151438.790268-1-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mbobrowski@mbobrowski.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).