From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>,
Qiliang Yuan <qiliang.yuan@linux.dev>,
Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH v3] block: don't wait for all RCU callbacks when freeing zone write plugs
Date: Thu, 26 Nov 2026 06:59:29 +0900 [thread overview]
Message-ID: <a4eca17c-3d44-47f8-96ff-135671c2354a@kernel.org> (raw)
In-Reply-To: <4149778a-99ac-4193-b06d-b032184953f9@acm.org>
On 11/26/26 02:00, Bart Van Assche wrote:
> On 11/25/26 00:41, Qiliang Yuan wrote:
> > 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%
>
> Real zoned drives taken offline on a storage node typically have
> partially written zones and therefore still have active zone write plugs
> in disk->zone_wplugs_hash at teardown time. The reason "null_blk, with
> plugs" only improves by 4% is that disk_destroy_zone_wplugs_hash_table()
> frees those remaining plugs via disk_mark_zone_wplug_dead() ->
> disk_free_zone_wplug() -> call_rcu(), which still forces an RCU grace
> period wait for every disk that had at least one active plug.
>
> By the time disk_destroy_zone_wplugs_hash_table() runs from
> disk_release(), no RCU readers can still be accessing
> disk->zone_wplugs_hash (the function already iterates the hash table
> without zone_wplugs_hash_lock, assumes every plug has ref == 1, and
> frees disk->zone_wplugs_hash synchronously with kfree()). Nor is
> updating disk->zones_state needed, as disk_release_zone_resources()
> clears it immediately afterward.
That is indeed a good point. Thanks Bart.
> Have you considered unhashing and freeing the plugs still in
> disk->zone_wplugs_hash directly with mempool_free() (keeping the
> WARN_ON_ONCE() checks) instead of going through call_rcu()? Then
> nr_zone_wplugs_freeing would only wait for plugs that were already
> queued for RCU freeing shortly before disk_release(), and the "with
> plugs" case would skip the RCU wait as well.
Yes, that should speeds things up significantly, since under normal
circumstances, calls to disk_release() are done with the drive already idle for
some time, and so no zone write plugs rcu free should be pending, most of the time.
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2026-11-25 21:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:41 [PATCH v3] block: don't wait for all RCU callbacks when freeing zone write plugs Qiliang Yuan
2026-11-25 17:00 ` Bart Van Assche
2026-11-25 21:59 ` 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=a4eca17c-3d44-47f8-96ff-135671c2354a@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