From: Ming Lei <ming.lei@redhat.com>
To: Nilay Shroff <nilay@linux.ibm.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, dlemoal@kernel.org,
axboe@kernel.dk, gjoyce@ibm.com
Subject: Re: [PATCHv2 1/6] blk-sysfs: remove q->sysfs_lock for attributes which don't need it
Date: Tue, 18 Feb 2025 20:10:24 +0800 [thread overview]
Message-ID: <Z7R4sBoVnCMIFYsu@fedora> (raw)
In-Reply-To: <20250218082908.265283-2-nilay@linux.ibm.com>
On Tue, Feb 18, 2025 at 01:58:54PM +0530, Nilay Shroff wrote:
> There're few sysfs attributes in block layer which don't really need
> acquiring q->sysfs_lock while accessing it. The reason being, writing
> a value to such attributes are either atomic or could be easily
> protected using WRITE_ONCE()/READ_ONCE(). Moreover, sysfs attributes
> are inherently protected with sysfs/kernfs internal locking.
>
> So this change help segregate all existing sysfs attributes for which
> we could avoid acquiring q->sysfs_lock. We group all such attributes,
> which don't require any sorts of locking, using macro QUEUE_RO_ENTRY_
> NOLOCK() or QUEUE_RW_ENTRY_NOLOCK(). The newly introduced show/store
> method (show_nolock/store_nolock) is assigned to attributes using these
> new macros. The show_nolock/store_nolock run without holding q->sysfs_
> lock.
>
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> ---
...
>
> +#define QUEUE_RO_ENTRY_NOLOCK(_prefix, _name) \
> +static struct queue_sysfs_entry _prefix##_entry = { \
> + .attr = {.name = _name, .mode = 0644 }, \
> + .show_nolock = _prefix##_show, \
> +}
> +
> +#define QUEUE_RW_ENTRY_NOLOCK(_prefix, _name) \
> +static struct queue_sysfs_entry _prefix##_entry = { \
> + .attr = {.name = _name, .mode = 0644 }, \
> + .show_nolock = _prefix##_show, \
> + .store_nolock = _prefix##_store, \
> +}
> +
> #define QUEUE_RW_ENTRY(_prefix, _name) \
> static struct queue_sysfs_entry _prefix##_entry = { \
> .attr = { .name = _name, .mode = 0644 }, \
> @@ -446,7 +470,7 @@ QUEUE_RO_ENTRY(queue_max_discard_segments, "max_discard_segments");
> QUEUE_RO_ENTRY(queue_discard_granularity, "discard_granularity");
> QUEUE_RO_ENTRY(queue_max_hw_discard_sectors, "discard_max_hw_bytes");
> QUEUE_LIM_RW_ENTRY(queue_max_discard_sectors, "discard_max_bytes");
> -QUEUE_RO_ENTRY(queue_discard_zeroes_data, "discard_zeroes_data");
> +QUEUE_RO_ENTRY_NOLOCK(queue_discard_zeroes_data, "discard_zeroes_data");
I think all QUEUE_RO_ENTRY needn't sysfs_lock, why do you just convert
part of them?
Thanks,
Ming
next prev parent reply other threads:[~2025-02-18 12:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 8:28 [PATCHv2 0/6] block: fix lock order and remove redundant locking Nilay Shroff
2025-02-18 8:28 ` [PATCHv2 1/6] blk-sysfs: remove q->sysfs_lock for attributes which don't need it Nilay Shroff
2025-02-18 8:46 ` Christoph Hellwig
2025-02-18 11:26 ` Nilay Shroff
2025-02-21 14:02 ` Nilay Shroff
2025-02-22 12:44 ` Ming Lei
2025-02-24 13:09 ` Nilay Shroff
2025-02-24 14:49 ` Christoph Hellwig
2025-02-26 12:09 ` Nilay Shroff
2025-02-24 8:41 ` Hannes Reinecke
2025-02-24 13:12 ` Nilay Shroff
2025-02-18 12:10 ` Ming Lei [this message]
2025-02-18 13:11 ` Nilay Shroff
2025-02-18 13:45 ` Ming Lei
2025-02-18 16:29 ` Christoph Hellwig
2025-02-19 3:24 ` Ming Lei
2025-02-19 5:42 ` Christoph Hellwig
2025-02-19 8:34 ` Nilay Shroff
2025-02-19 8:56 ` Nilay Shroff
2025-02-19 9:20 ` Ming Lei
2025-02-18 8:28 ` [PATCHv2 2/6] blk-sysfs: acquire q->limits_lock while reading attributes Nilay Shroff
2025-02-18 8:46 ` Christoph Hellwig
2025-02-18 8:28 ` [PATCHv2 3/6] block: Introduce a dedicated lock for protecting queue elevator updates Nilay Shroff
2025-02-18 9:05 ` Christoph Hellwig
2025-02-18 11:14 ` Nilay Shroff
2025-02-18 16:32 ` Christoph Hellwig
2025-02-19 8:41 ` Nilay Shroff
2025-02-18 8:28 ` [PATCHv2 4/6] blk-sysfs: protect nr_requests update using q->elevator_lock Nilay Shroff
2025-02-18 8:28 ` [PATCHv2 5/6] blk-sysfs: protect wbt_lat_usec " Nilay Shroff
2025-02-18 8:28 ` [PATCHv2 6/6] blk-sysfs: protect read_ahead_kb using q->limits_lock Nilay Shroff
2025-02-18 9:12 ` Christoph Hellwig
2025-02-18 11:27 ` Nilay Shroff
2025-02-18 9:21 ` [PATCHv2 0/6] block: fix lock order and remove redundant locking Christoph Hellwig
2025-02-18 12:09 ` Nilay Shroff
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=Z7R4sBoVnCMIFYsu@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=nilay@linux.ibm.com \
/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