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: linux-block@vger.kernel.org
Subject: Re: [PATCH] block: don't wait for all RCU callbacks when freeing zone write plugs
Date: Tue, 24 Nov 2026 13:28:45 +0900	[thread overview]
Message-ID: <7c2c47bf-3bfc-4c69-acca-65aafb007397@kernel.org> (raw)
In-Reply-To: <20261121-feat-blk-zoned-rcu-barrier-v1-1-766875b525be@linux.dev>

On 11/22/26 09:57, 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 wait only for that count to drop to zero.
> 
> Removing 32 zoned null_blk or scsi_debug devices, base and patched
> kernels alternating over 2 rounds of 3 runs, median of the 6 runs and
> 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                   820 (805-885)   438 (424-454)     -47%
>   null_blk, with plugs       876 (852-883)   844 (805-877)      -4%
>   scsi_debug, host-managed   958 (945-991)   642 (630-652)     -33%
> 
> Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>

Looks OK, modulo one nit below.

With that,

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

> @@ -2146,10 +2151,11 @@ static void disk_destroy_zone_wplugs_hash_table(struct gendisk *disk)
>  	disk->zone_wplugs_hash_bits = 0;
>  
>  	/*
> -	 * Wait for the zone write plugs to be RCU-freed before destroying the
> -	 * mempool.
> +	 * Wait only for the RCU callbacks freeing the zone write plugs of this
> +	 * disk before destroying the mempool.

The "only" in this sentence makes sense when considering rcu_barrier() vs your
change. So I think that the comment can stay as it is since that also describes
your change.

-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2026-11-24  4:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  0:57 [PATCH] block: don't wait for all RCU callbacks when freeing zone write plugs Qiliang Yuan
2026-11-24  4:28 ` Damien Le Moal [this message]

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=7c2c47bf-3bfc-4c69-acca-65aafb007397@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --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