mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: alexjlzheng@gmail.com
Cc: alexjlzheng@tencent.com, linux-kernel@vger.kernel.org, tj@kernel.org
Subject: Re: [PATCH kernfs 1/3] kernfs: switch global kernfs_idr_lock to per-fs lock
Date: Sun, 13 Apr 2025 09:51:29 +0200	[thread overview]
Message-ID: <2025041318-unnatural-caucasian-48d2@gregkh> (raw)
In-Reply-To: <20250412115054.25580-1-alexjlzheng@tencent.com>

On Sat, Apr 12, 2025 at 07:50:54PM +0800, alexjlzheng@gmail.com wrote:
> On Sat, 12 Apr 2025 08:12:22 +0200, gregkh@linuxfoundation.org wrote:
> > On Sat, Apr 13, 2025 at 02:31:07AM +0800, alexjlzheng@gmail.com wrote:
> > > From: Jinliang Zheng <alexjlzheng@tencent.com>
> > > 
> > > The kernfs implementation has big lock granularity(kernfs_idr_lock) so
> > > every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the lock.
> > > 
> > > This patch switches the global kernfs_idr_lock to per-fs lock, which
> > > put the spinlock into kernfs_root.
> > > 
> > > Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
> > > ---
> > >  fs/kernfs/dir.c             | 14 +++++++-------
> > >  fs/kernfs/kernfs-internal.h |  1 +
> > >  2 files changed, 8 insertions(+), 7 deletions(-)
> > 
> > What kind of testing / benchmark did you do for this series that shows
> > that this works, AND that this actually is measureable?  What workload
> > are you doing that causes these changes to be needed?
> 
> Thank you for your reply. :)
> 
> We are trying to implement a kernfs-based filesystem that will have
> multiple instances running at the same time, i.e., multiple kernfs_roots.

I don't think that kernfs is meant for that very well, what is that
filesystem going to be for?

> While investigating the kernfs implementation, we found some global locks
> that would cause noticeable lock contention when there are many filesystem
> instances.
> 
> Fortunately, we found that some optimizations have been made in [1], which
> moved kernfs_rwsem into kernfs_root. But there are still some global locks
> left.
> 
> We think it is also necessary to switch the remaining global locks to
> per-fs. Moreover, we strongly agree with Tejun Heo's point in [1]:
> 
>   "... this is the right thing to do even if there is no concrete
>    performance argument (not saying there isn't). It's just weird to
>    entangle these completely unrelated users in a single rwsem."
> 
> We think kernfs will be widely used to build other filesystems, so we
> strongly recommend switching global locks to per-fs.

I don't strongly object, but I would like to see some real-world numbers first.

thanks,

greg k-h

  reply	other threads:[~2025-04-13  7:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 18:31 [PATCH kernfs 0/3] kernfs: switch global locks " alexjlzheng
2025-04-11 18:31 ` [PATCH kernfs 1/3] kernfs: switch global kernfs_idr_lock " alexjlzheng
2025-04-12  6:12   ` Greg KH
2025-04-12 11:50     ` alexjlzheng
2025-04-13  7:51       ` Greg KH [this message]
2025-04-14  3:20         ` Jinliang Zheng
2025-04-15 15:16           ` Greg KH
2025-04-15 15:44             ` Jinliang Zheng
2025-04-14 17:09   ` Tejun Heo
2025-04-15  6:28     ` Jinliang Zheng
2025-04-11 18:31 ` [PATCH kernfs 2/3] kernfs: switch global kernfs_rename_lock " alexjlzheng
2025-04-14 17:26   ` Tejun Heo
2025-04-11 18:31 ` [PATCH kernfs 3/3] kernfs: switch global kernfs_pr_cont_lock " alexjlzheng
2025-04-14 17:27   ` Tejun Heo
2025-04-15  6:37     ` Jinliang Zheng

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=2025041318-unnatural-caucasian-48d2@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alexjlzheng@gmail.com \
    --cc=alexjlzheng@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.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

all inboxes | Powered by JetHome®