[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZWylT2SuN+N2Z2K@google.com>
Date: Wed, 17 Nov 2021 17:55:33 -0800
From: Minchan Kim <minchan@...nel.org>
To: Tejun Heo <tj@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] kernfs: release kernfs_mutex before the inode
allocation
On Wed, Nov 17, 2021 at 12:23:55PM -1000, Tejun Heo wrote:
> Hello,
>
> On Wed, Nov 17, 2021 at 02:13:35PM -0800, Minchan Kim wrote:
> > > So, one really low hanging fruit here would be using a separate rwsem per
> > > superblock. Nothing needs synchronization across different users of kernfs
> > > and the locking is shared just because nobody bothered to separate them out
> > > while generalizing it from sysfs.
> >
> > That's really what I wanted but had a question whether we can access
> > superblock from the kernfs_node all the time since there are some
> > functions to access the kernfs_rwsem without ionde, sb context.
> >
> > Is it doable to get the superblock from the kernfs_node all the time?
>
> Ah, right, kernfs_node doesn't point back to kernfs_root. I guess it can go
> one of three ways:
Thanks for the suggestion, Tejun.
I found kernfs_root and it seems like to return kernfs_root from kernfs_node.
If it's true all the case, we would put the rwsem in kernfs_root and change
would be straightforward. Do you see any problem?
>
> a. Follow parent until root kernfs_node and make that guy point to
> kernfs_root through its parent field. This isn't great but the hotter
> paths all have sb / inode already, I think, so if we do this only in the
> really cold paths, it likely isn't too bad.
>
> b. Change the interface so that the callers have to provide kernfs_root. I
> don't think this is gonna be a huge problem. There are a few users of
> kernfs and they always know their roots.
>
> c. Add a field to kernfs_node so that we can always find kernfs_root.
>
> I think b is likely the cheapest && cleanest.
>
> Thanks.
>
> --
> tejun
Powered by blists - more mailing lists