From: Mateusz Guzik <mjguzik@gmail.com>
To: brauner@kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
bharata@amd.com, Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH] vfs: use RCU in ilookup
Date: Mon, 15 Jul 2024 09:13:24 +0200 [thread overview]
Message-ID: <20240715071324.265879-1-mjguzik@gmail.com> (raw)
A soft lockup in ilookup was reported when stress-testing a 512-way
system [1] (see [2] for full context) and it was verified that not
taking the lock shifts issues back to mm.
[1] https://lore.kernel.org/linux-mm/56865e57-c250-44da-9713-cf1404595bcc@amd.com/
[2] https://lore.kernel.org/linux-mm/d2841226-e27b-4d3d-a578-63587a3aa4f3@amd.com/
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
fwiw the originally sent patch to the reporter performs a lockless
lookup first and falls back to the locked variant, but that was me
playing overfly safe.
I would add tested-by but patches are not the same in the end.
This is the only spot which can get this fixup, everything else taking
the lock is also using custom callbacks, so filesystems invoking such
code will need to get patched up on case-by-case basis (but
realistically they probably already can do RCU-only operation).
fs/inode.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index f356fe2ec2b6..52ca063c552c 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1525,9 +1525,7 @@ struct inode *ilookup(struct super_block *sb, unsigned long ino)
struct hlist_head *head = inode_hashtable + hash(sb, ino);
struct inode *inode;
again:
- spin_lock(&inode_hash_lock);
- inode = find_inode_fast(sb, head, ino, true);
- spin_unlock(&inode_hash_lock);
+ inode = find_inode_fast(sb, head, ino, false);
if (inode) {
if (IS_ERR(inode))
--
2.43.0
next reply other threads:[~2024-07-15 7:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 7:13 Mateusz Guzik [this message]
2024-07-15 8:02 ` [PATCH] vfs: use RCU in ilookup Bharata B Rao
2024-07-15 8:05 ` Mateusz Guzik
2024-07-15 11:37 ` Christian Brauner
2024-07-16 13:55 ` 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=20240715071324.265879-1-mjguzik@gmail.com \
--to=mjguzik@gmail.com \
--cc=bharata@amd.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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