From: Ian Kent <raven@themaw.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
l Viro <viro@ZenIV.linux.org.uk>, Tejun Heo <tj@kernel.org>,
Rick Lindsley <ricklind@linux.vnet.ibm.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
David Howells <dhowells@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] kernfs: switch kernfs to use an rwsem
Date: Mon, 08 Jun 2020 17:58:39 +0800 [thread overview]
Message-ID: <6e408041ae9bedb2269cf607d7313a414c7cead3.camel@themaw.net> (raw)
In-Reply-To: <36e2d782d1aea1cfbe17f3bfee35f723f2f89c0d.camel@themaw.net>
On Sun, 2020-06-07 at 16:40 +0800, Ian Kent wrote:
> Hi Greg,
>
> On Mon, 2020-05-25 at 13:47 +0800, Ian Kent wrote:
> > @@ -189,9 +189,9 @@ int kernfs_iop_getattr(const struct path *path,
> > struct kstat *stat,
> > struct inode *inode = d_inode(path->dentry);
> > struct kernfs_node *kn = inode->i_private;
> >
> > - mutex_lock(&kernfs_mutex);
> > + down_read(&kernfs_rwsem);
> > kernfs_refresh_inode(kn, inode);
> > - mutex_unlock(&kernfs_mutex);
> > + up_read(&kernfs_rwsem);
> >
> > generic_fillattr(inode, stat);
> > return 0;
> > @@ -281,9 +281,9 @@ int kernfs_iop_permission(struct inode *inode,
> > int mask)
> >
> > kn = inode->i_private;
> >
> > - mutex_lock(&kernfs_mutex);
> > + down_read(&kernfs_rwsem);
> > kernfs_refresh_inode(kn, inode);
> > - mutex_unlock(&kernfs_mutex);
> > + up_read(&kernfs_rwsem);
> >
> > return generic_permission(inode, mask);
> > }
>
> I changed these from a write lock to a read lock late in the
> development.
>
> But kernfs_refresh_inode() modifies the inode so I think I should
> have taken the inode lock as well as taking the read lock.
>
> I'll look again but a second opinion (anyone) would be welcome.
I had a look at this today and came up with a couple of patches
to fix it, I don't particularly like to have to do what I did
but I don't think there's any other choice. That's because the
rb tree locking is under significant contention and changing
this back to use the write lock will adversely affect that.
But unless I can find out more about the anomalous kernel test
robot result I can't do anything!
Providing a job.yaml to reproduce it with the hardware specification
of the lkp machine it was run on and no guidelines on what that test
does and what the test needs so it can actually be reproduced isn't
that useful.
Ian
next prev parent reply other threads:[~2020-06-08 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 5:46 [PATCH 0/4] kernfs: proposed locking and concurrency improvement Ian Kent
2020-05-25 5:47 ` [PATCH 1/4] kernfs: switch kernfs to use an rwsem Ian Kent
2020-06-06 15:52 ` [kernfs] ea7c5fc39a: stress-ng.stream.ops_per_sec 11827.2% improvement kernel test robot
2020-06-06 18:18 ` Greg Kroah-Hartman
2020-06-07 1:13 ` Ian Kent
2020-06-11 2:06 ` kernel test robot
2020-06-11 2:20 ` Rick Lindsley
2020-06-11 3:02 ` Ian Kent
2020-06-07 8:40 ` [PATCH 1/4] kernfs: switch kernfs to use an rwsem Ian Kent
2020-06-08 9:58 ` Ian Kent [this message]
2020-05-25 5:47 ` [PATCH 2/4] kernfs: move revalidate to be near lookup Ian Kent
2020-05-25 5:47 ` [PATCH 3/4] kernfs: improve kernfs path resolution Ian Kent
2020-05-25 5:47 ` [PATCH 4/4] kernfs: use revision to identify directory node changes Ian Kent
2020-05-25 6:16 ` [PATCH 0/4] kernfs: proposed locking and concurrency improvement Greg Kroah-Hartman
2020-05-25 7:23 ` Ian Kent
2020-05-25 7:31 ` Greg Kroah-Hartman
2020-05-27 12:44 ` Rick Lindsley
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=6e408041ae9bedb2269cf607d7313a414c7cead3.camel@themaw.net \
--to=raven@themaw.net \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=ricklind@linux.vnet.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=tj@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
all inboxes | Powered by JetHome®