[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3173d8cd-108e-54b1-e72d-19f32e6adbb7@oracle.com>
Date: Fri, 3 Mar 2023 08:28:38 +1100
From: Imran Khan <imran.f.khan@...cle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: tj@...nel.org, gregkh@...uxfoundation.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
joe.jin@...cle.com
Subject: Re: [PATCH 2/3] kernfs: Use a per-fs rwsem to protect per-fs list of
kernfs_super_info.
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@...cle.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
Powered by blists - more mailing lists