mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Qiliang Yuan <odys.yuan@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, Ming Lei <tom.leiming@gmail.com>,
	Yu Kuai <yukuai@fygo.io>, Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <mkp@kernel.org>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] blk-mq: stop waiting for an SRCU grace period when freeing a tag set
Date: Thu, 1 Oct 2026 09:10:26 -0700	[thread overview]
Message-ID: <3680179e-da3d-4689-96cd-58dce29a96e9@paulmck-laptop> (raw)
In-Reply-To: <20261001-bug-blk-mq-global-tags-srcu-v1-0-e8415da10d1b@gmail.com>

On Thu, Oct 01, 2026 at 05:17:49PM +0800, Qiliang Yuan wrote:
> blk_mq_free_tag_set() calls srcu_barrier() on the tag set's own
> tags_srcu before cleaning it up. That costs a full SRCU grace period,
> 1-3 ms, on every tag set teardown. When the free happens under a lock,
> the cost multiplies. ublk drops its last device reference under the
> global ublk_ctl_mutex, which caps 16-thread deletion of 4000 devices at
> 19 s on 7.3-rc5.
> 
> The SRCU callbacks free only blk-mq-owned memory and never touch the
> tag set, so patch 1 makes the SRCU instance global and drops the
> per-set barrier and cleanup. Patch 2 removes the tag_set argument that
> was added to blk_mq_free_rq_map() and blk_mq_free_tags() only to reach
> the per-set instance.
> 
> With patch 1, 16-thread deletion of 4000 ublk devices takes 2.9 s and
> serial DEL_DEV drops from 3.45 ms to 0.17 ms. Destroying 256 null_blk
> devices from 16 threads goes from 5.15 s to 4.30 s.
> 
> Tested on 7.3-rc5 with ublk and null_blk create/destroy loops. A
> KASAN + lockdep + DEBUG_OBJECTS_RCU_HEAD kernel ran a 10-minute stress
> that raced device creation and destruction, I/O, scheduler and
> nr_requests changes, and CPU hotplug against inflight, debugfs busy and
> tags readers. It produced no reports.
> 
> Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com>

Looks plausible from an RCU viewpoint.

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> ---
> Qiliang Yuan (2):
>       blk-mq: share one tags_srcu instance across all tag sets
>       blk-mq: drop the tag_set argument from blk_mq_free_rq_map/tags
> 
>  block/blk-mq-tag.c     | 19 +++++++++++++------
>  block/blk-mq.c         | 25 +++++++++----------------
>  block/blk-mq.h         |  6 ++++--
>  include/linux/blk-mq.h |  3 ---
>  4 files changed, 26 insertions(+), 27 deletions(-)
> ---
> base-commit: 551c722f40809618230001baccf219193e22fc5a
> change-id: 20261001-bug-blk-mq-global-tags-srcu-811e8d958281
> 
> Best regards,
> -- 
> Qiliang Yuan <odys.yuan@gmail.com>
> 

  parent reply	other threads:[~2026-10-01 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  9:17 Qiliang Yuan
2026-10-01  9:17 ` [PATCH 1/2] blk-mq: share one tags_srcu instance across all tag sets Qiliang Yuan
2026-10-16  4:17   ` Ming Lei
2026-10-01  9:17 ` [PATCH 2/2] blk-mq: drop the tag_set argument from blk_mq_free_rq_map/tags Qiliang Yuan
2026-10-16  4:18   ` Ming Lei
2026-10-01 16:10 ` Paul E. McKenney [this message]
2026-10-15  2:26 ` [PATCH 0/2] blk-mq: stop waiting for an SRCU grace period when freeing a tag set Qiliang Yuan
2026-10-16 14:28 ` Jens Axboe

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=3680179e-da3d-4689-96cd-58dce29a96e9@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=odys.yuan@gmail.com \
    --cc=tom.leiming@gmail.com \
    --cc=yukuai@fygo.io \
    /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

all inboxes | Powered by JetHome®