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 1/3] kernfs: Introduce separate rwsem to protect inode attributes.
Date: Fri, 3 Mar 2023 07:32:00 +1100	[thread overview]
Message-ID: <27bcb12e-453c-449e-e4f9-93ac7a3dcaa2@oracle.com> (raw)
In-Reply-To: <ZADLTO0NM1yb5ZLF@casper.infradead.org>

Hello Matthew,
Thanks for reviewing this,

On 3/3/2023 3:14 am, Matthew Wilcox wrote:
> On Thu, Mar 02, 2023 at 03:32:01PM +1100, Imran Khan wrote:
>> +++ b/fs/kernfs/kernfs-internal.h
>> @@ -47,6 +47,7 @@ struct kernfs_root {
>>  
>>  	wait_queue_head_t	deactivate_waitq;
>>  	struct rw_semaphore	kernfs_rwsem;
>> +	struct rw_semaphore	kernfs_iattr_rwsem;
>>  };
>>  
>>  /* +1 to avoid triggering overflow warning when negating it */
> 
> Can you explain why we want one iattr rwsem per kernfs_root instead of
> one rwsem per kernfs_node?

Having an iattr rwsem per kernfs_node would increase memory usage due to
kobjects. I had tried per kernfs_node approach for a couple of other global
locks earlier [1], but that approach was not encouraged because it would impact
ability to use sysfs on low memory (especially 32 bit) systems. This was the
reason for keeping iattr rwsem in kernfs_root.

Thanks,
Imran

[1]: https://lore.kernel.org/all/YdLH6qQNxa11YmRO@kroah.com/

  reply	other threads:[~2023-03-02 20:33 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 [this message]
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
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=27bcb12e-453c-449e-e4f9-93ac7a3dcaa2@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).