Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Qiliang Yuan <qiliang.yuan@linux.dev>, Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>, linux-block@vger.kernel.org
Subject: Re: [PATCH v4 1/2] block: don't wait for all RCU callbacks when freeing zone write plugs
Date: Mon, 30 Nov 2026 13:32:26 +0900	[thread overview]
Message-ID: <a8191567-53cb-48a6-b7ab-5c7a9e3e2569@kernel.org> (raw)
In-Reply-To: <20261126-feat-blk-zoned-rcu-barrier-v4-1-a4ab1d2162e0@linux.dev>

On 11/27/26 12:43, Qiliang Yuan wrote:
> Zone write plugs are allocated from a per-disk mempool and freed with
> call_rcu(). Before destroying the mempool, which happens every time a
> zoned disk is released, disk_destroy_zone_wplugs_hash_table() calls
> rcu_barrier() so that no zone write plug is still waiting to be returned
> to it.
> 
> rcu_barrier() waits for the RCU callbacks queued on every CPU by anyone,
> which usually takes a grace period or more, even when the disk had no
> zone write plug left to free. Removing many zoned disks, such as the SMR
> drives of a storage node taken offline, pays this once per disk.
> 
> Count the zone write plugs of the disk that wait for their RCU callback,
> and call rcu_barrier() only when that count is not zero. Use
> rcu_barrier() rather than waiting for the count to drop, so that lazily
> queued callbacks (CONFIG_RCU_LAZY) are still flushed.
> 
> Removing 32 zoned null_blk or scsi_debug devices, base and patched
> kernels alternating over 4 rounds of 5 runs, median of the 20 runs and
> interquartile range in parentheses; "with plugs" leaves four partially
> written zones, and so four zone write plugs, on each null_blk device:
> 
>   devices                        before (ms)      after (ms)   change
>   null_blk                     848 (828-862)   424 (410-430)     -50%
>   null_blk, with plugs         865 (854-876)   876 (866-886)      +1%
>   scsi_debug, host-managed  1057 (1024-1092)   740 (722-779)     -30%
> 
> Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>

I am not sure that the atomic_read_acquire() is necessary (atomic_read() should
be fine), but I guess it does not hurt either.
So,

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-11-30  4:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  3:43 [PATCH v4 0/2] block: skip rcu_barrier() when releasing zoned disks Qiliang Yuan
2026-11-27  3:43 ` [PATCH v4 1/2] block: don't wait for all RCU callbacks when freeing zone write plugs Qiliang Yuan
2026-11-30  4:32   ` Damien Le Moal [this message]
2026-11-27  3:43 ` [PATCH v4 2/2] block: free remaining zone write plugs directly on disk release Qiliang Yuan
2026-11-30  4:32   ` Damien Le Moal

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=a8191567-53cb-48a6-b7ab-5c7a9e3e2569@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=qiliang.yuan@linux.dev \
    /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