public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
	ming.lei@redhat.com, muchun.song@linux.dev,
	mkhalfella@purestorage.com, chris.friesen@windriver.com,
	stable@vger.kernel.org, sunlightlinux@gmail.com,
	ionut_n2001@yahoo.com
Subject: Re: [PATCH v3 1/1] block/blk-mq: use atomic_t for quiesce_depth to avoid lock contention on RT
Date: Thu, 12 Feb 2026 15:48:41 +0100	[thread overview]
Message-ID: <20260212144841.95-yCgJm@linutronix.de> (raw)
In-Reply-To: <20260211203928.324307-2-ionut.nechita@windriver.com>

On 2026-02-11 22:39:29 [+0200], Ionut Nechita (Wind River) wrote:
> From: Ionut Nechita <ionut.nechita@windriver.com>
> 
> In RT kernel (PREEMPT_RT), commit 679b1874eba7 ("block: fix ordering
> between checking QUEUE_FLAG_QUIESCED request adding") causes severe
> Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Fixes: 679b1874eba7 ("block: fix ordering between checking QUEUE_FLAG_QUIESCED request adding")
This is
         6bda857bcbb86 ("block: fix ordering between checking QUEUE_FLAG_QUIESCED request adding")

in my tree. I don't have your hash anywhere. The hash at the top in the
email is also affected.

> Cc: stable@vger.kernel.org
> Signed-off-by: Ionut Nechita <ionut.nechita@windriver.com>

Otherwise
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -314,21 +314,18 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
>   */
>  void blk_mq_unquiesce_queue(struct request_queue *q)
>  {
> -	unsigned long flags;
> -	bool run_queue = false;
> +	int depth;
>  
> -	spin_lock_irqsave(&q->queue_lock, flags);
> -	if (WARN_ON_ONCE(q->quiesce_depth <= 0)) {
> -		;
> -	} else if (!--q->quiesce_depth) {
> -		blk_queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
> -		run_queue = true;
> -	}
> -	spin_unlock_irqrestore(&q->queue_lock, flags);
> +	depth = atomic_dec_if_positive(&q->quiesce_depth);
> +	if (WARN_ON_ONCE(depth < 0))
> +		return;

Ah. That is cute.

> -	/* dispatch requests which are inserted during quiescing */
> -	if (run_queue)
> +	if (depth == 0) {
> +		/* Ensure the decrement is visible before running queues */
> +		smp_mb__after_atomic();
> +		/* dispatch requests which are inserted during quiescing */
>  		blk_mq_run_hw_queues(q, true);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_unquiesce_queue);
>  

Sebastian

      reply	other threads:[~2026-02-12 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 20:39 [PATCH v3 1/1] block/blk-mq: use atomic_t for quiesce_depth to avoid lock contention on RT Ionut Nechita (Wind River)
2026-02-12 14:48 ` Sebastian Andrzej Siewior [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=20260212144841.95-yCgJm@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=axboe@kernel.dk \
    --cc=chris.friesen@windriver.com \
    --cc=ionut.nechita@windriver.com \
    --cc=ionut_n2001@yahoo.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=mkhalfella@purestorage.com \
    --cc=muchun.song@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=sunlightlinux@gmail.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