From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, LKP <lkp@01.org>
Subject: [PATCH] fsnotify: fix unlink performance regression
Date: Sun, 5 May 2019 12:15:49 +0300 [thread overview]
Message-ID: <20190505091549.1934-1-amir73il@gmail.com> (raw)
__fsnotify_parent() has an optimization in place to avoid unneeded
take_dentry_name_snapshot(). When fsnotify_nameremove() was changed
not to call __fsnotify_parent(), we left out the optimization.
Kernel test robot reported a 5% performance regression in concurrent
unlink() workload.
Reported-by: kernel test robot <rong.a.chen@intel.com>
Link: https://lore.kernel.org/lkml/20190505062153.GG29809@shao2-debian/
Link: https://lore.kernel.org/linux-fsdevel/20190104090357.GD22409@quack2.suse.cz/
Fixes: 5f02a8776384 ("fsnotify: annotate directory entry modification events")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
Jan,
The linked 5.1-rc1 performance regression report came with bad timing.
Not sure if Linus is planning an rc8. If not, you will probably not
see this before the 5.1 release and we shall have to queue it for 5.2
and backport to stable 5.1.
I crafted the patch so it applies cleanly both to master and Al's
for-next branch (there are some fsnotify changes in work.dcache).
Thanks,
Amir.
include/linux/fsnotify.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 09587e2860b5..2272c8c2023c 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -175,12 +175,19 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
mask |= FS_ISDIR;
parent = dget_parent(dentry);
+ /* Avoid unneeded take_dentry_name_snapshot() */
+ if (!(d_inode(parent)->i_fsnotify_mask & FS_DELETE) &&
+ !(dentry->d_sb->s_fsnotify_mask & FS_DELETE))
+ goto out_dput;
+
take_dentry_name_snapshot(&name, dentry);
fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
name.name, 0);
release_dentry_name_snapshot(&name);
+
+out_dput:
dput(parent);
}
--
2.17.1
next reply other threads:[~2019-05-05 9:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-05 9:15 Amir Goldstein [this message]
2019-05-05 13:05 ` [PATCH] fsnotify: fix unlink performance regression Al Viro
2019-05-05 13:19 ` Amir Goldstein
2019-05-05 13:47 ` Al Viro
2019-05-05 14:18 ` Amir Goldstein
2019-05-06 12:43 ` Amir Goldstein
2019-05-06 14:26 ` Al Viro
2019-05-06 16:22 ` Amir Goldstein
2019-05-05 16:33 ` kbuild test robot
2019-05-05 18:26 ` Amir Goldstein
2019-05-05 20:07 ` [PATCH v2] " Amir Goldstein
2019-05-07 16:19 ` Jan Kara
2019-05-07 19:12 ` Amir Goldstein
2019-05-08 16:09 ` Amir Goldstein
2019-05-09 10:31 ` Jan Kara
2019-05-10 15:24 ` Amir Goldstein
2019-05-13 16:33 ` Jan Kara
2019-05-13 16:47 ` Amir Goldstein
2019-05-09 9:46 ` Jan Kara
2019-05-10 14:57 ` Amir Goldstein
2019-05-13 16:23 ` 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=20190505091549.1934-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lkp@01.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).