linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Imran Khan <imran.f.khan@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: tj@kernel.org, gregkh@linuxfoundation.org,
	viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, joe.jin@oracle.com
Subject: Re: [PATCH 2/3] kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info.
Date: Fri, 3 Mar 2023 08:28:38 +1100	[thread overview]
Message-ID: <3173d8cd-108e-54b1-e72d-19f32e6adbb7@oracle.com> (raw)
In-Reply-To: <ZADJ85K6KTb6XiR4@casper.infradead.org>

Hello Matthew,
Thanks for reviewing this.

On 3/3/2023 3:08 am, Matthew Wilcox wrote:
> On Thu, Mar 02, 2023 at 03:32:02PM +1100, Imran Khan wrote:
>> Right now per-fs kernfs_rwsem protects list of kernfs_super_info instances
>> for a kernfs_root. Since kernfs_rwsem is used to synchronize several other
>> operations across kernfs and since most of these operations don't impact
>> kernfs_super_info, we can use a separate per-fs rwsem to synchronize access
>> to list of kernfs_super_info.
>> This helps in reducing contention around kernfs_rwsem and also allows
>> operations that change/access list of kernfs_super_info to proceed without
>> contending for kernfs_rwsem.
>>
>> Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
> 
> But you don't remove the acquisition of kernfs_rwsem in
> kernfs_notify_workfn(), so I don't see how this helps?
> 
Yes. kernfs_notify_workfn should no longer need kernfs_rwsem. I will fix it .
> Also, every use of this rwsem is as a writer, so it could/should be a
> plain mutex, no?  Or should you be acquiring it for read in
> kernfs_notify_workfn()?

Although currently kernfs_notify_workfn acquires kernfs_rwsem for writing, I
think even w/o this change acquiring kernfs_rwsem for reading would be enough
since we are not making any changes to kernfs_super_info list.
Based on this logic, I think taking iattr rwsem for reading is right approach.

Thanks,
Imran

  reply	other threads:[~2023-03-02 22:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02  4:32 [PATCH 0/3] kernfs: Introduce separate rwsem to protect inode Imran Khan
2023-03-02  4:32 ` [PATCH 1/3] kernfs: Introduce separate rwsem to protect inode attributes Imran Khan
2023-03-02 16:14   ` Matthew Wilcox
2023-03-02 20:32     ` Imran Khan
2023-03-02  4:32 ` [PATCH 2/3] kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info Imran Khan
2023-03-02 16:08   ` Matthew Wilcox
2023-03-02 21:28     ` Imran Khan [this message]
2023-03-02  4:32 ` [PATCH 3/3] kernfs: change kernfs_rename_lock into a read-write lock Imran Khan
2023-03-02 18:49   ` Matthew Wilcox

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=3173d8cd-108e-54b1-e72d-19f32e6adbb7@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe.jin@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).