linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: brauner@kernel.org
Cc: Chuck Lever <chuck.lever@oracle.com>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] libfs: Add a lock class for the offset map's xa_lock
Date: Mon, 24 Jul 2023 10:43:57 -0400	[thread overview]
Message-ID: <169020933088.160441.9405180953116076087.stgit@manet.1015granger.net> (raw)

From: Chuck Lever <chuck.lever@oracle.com>

Tie the dynamically-allocated xarray locks into a single class so
contention on the directory offset xarrays can be observed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/libfs.c |    3 +++
 1 file changed, 3 insertions(+)

I've been looking into the recent kernel bot reports of performance
regressions on the will-it-scale benchmark.

https://lore.kernel.org/linux-mm/202307171640.e299f8d5-oliver.sang@intel.com/

I haven't been able to run the reproducer yet, but I have created a
small change to demonstrate that it is unlikely that it is the
xa_lock itself that is the issue. All tests I've run here show "0.0"
in the lock_stat contention metrics for the simple_offset_xa_lock
class.

It seems reasonable to include this small change in the patches
already applied to your tree.


diff --git a/fs/libfs.c b/fs/libfs.c
index 68b0000dc518..fcc0f1f3c2dc 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -249,6 +249,8 @@ static unsigned long dentry2offset(struct dentry *dentry)
 	return (unsigned long)dentry->d_fsdata;
 }
 
+static struct lock_class_key simple_offset_xa_lock;
+
 /**
  * simple_offset_init - initialize an offset_ctx
  * @octx: directory offset map to be initialized
@@ -257,6 +259,7 @@ static unsigned long dentry2offset(struct dentry *dentry)
 void simple_offset_init(struct offset_ctx *octx)
 {
 	xa_init_flags(&octx->xa, XA_FLAGS_ALLOC1);
+	lockdep_set_class(&octx->xa.xa_lock, &simple_offset_xa_lock);
 
 	/* 0 is '.', 1 is '..', so always start with offset 2 */
 	octx->next_offset = 2;




             reply	other threads:[~2023-07-24 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 14:43 Chuck Lever [this message]
2023-07-24 14:55 ` Christian Brauner

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=169020933088.160441.9405180953116076087.stgit@manet.1015granger.net \
    --to=cel@kernel.org \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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