Skip to content

block/blk-mq: use atomic_t for quiesce_depth to avoid lock contention on RT#552

Open
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1053247=>linus-master
Open

block/blk-mq: use atomic_t for quiesce_depth to avoid lock contention on RT#552
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1053247=>linus-master

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Feb 12, 2026

Pull request for series with
subject: block/blk-mq: use atomic_t for quiesce_depth to avoid lock contention on RT
version: 3
url: https://patchwork.kernel.org/project/linux-block/list/?series=1053247

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 12, 2026

Upstream branch: c22e26b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053247
version: 3

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 12, 2026

Upstream branch: 37a93dd
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053247
version: 3

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from b0802e7 to b57a767 Compare February 12, 2026 06:30
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 12, 2026

Upstream branch: 37a93dd
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053247
version: 3

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from b57a767 to bf69262 Compare February 12, 2026 17:02
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 49ecc64 to 0525b37 Compare February 13, 2026 02:22
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 13, 2026

Upstream branch: 7449f86
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053247
version: 3

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from bf69262 to 607d496 Compare February 13, 2026 02:26
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 13, 2026

Upstream branch: 7449f86
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053820
version: 4

@blktests-ci blktests-ci bot added V4 and removed V3 labels Feb 13, 2026
@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from 607d496 to a2259e8 Compare February 13, 2026 07:29
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 0525b37 to 6de2940 Compare February 13, 2026 13:13
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 13, 2026

Upstream branch: cee73b1
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053820
version: 4

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from a2259e8 to ff3d6b3 Compare February 13, 2026 13:14
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6de2940 to bbff8a4 Compare February 15, 2026 15:16
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 15, 2026

Upstream branch: ca4ee40
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053820
version: 4

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from ff3d6b3 to cbc9798 Compare February 15, 2026 15:19
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from bbff8a4 to be7af85 Compare February 16, 2026 02:04
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 16, 2026

Upstream branch: 26a4cfa
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053820
version: 4

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from cbc9798 to c60c125 Compare February 16, 2026 02:08
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from be7af85 to bfa4f99 Compare February 16, 2026 14:50
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 16, 2026

Upstream branch: 0f2acd3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1053820
version: 4

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from c60c125 to a18d878 Compare February 16, 2026 14:52
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from bfa4f99 to e2350d3 Compare February 17, 2026 09:58
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: af4e9ef
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from c237dde to 7b14387 Compare March 4, 2026 08:00
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from d0e1bed to 6b51c57 Compare March 4, 2026 09:34
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: 0031c06
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from 7b14387 to ee76c58 Compare March 4, 2026 09:43
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6b51c57 to 78036b2 Compare March 4, 2026 19:57
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: ecc64d2
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from ee76c58 to 447dca3 Compare March 4, 2026 20:06
@kawasaki kawasaki closed this Mar 5, 2026
@blktests-ci blktests-ci bot reopened this Mar 5, 2026
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 5, 2026

Upstream branch: c107785
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from 447dca3 to a152354 Compare March 5, 2026 12:29
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from bbb3394 to 901a429 Compare March 5, 2026 21:37
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 5, 2026

Upstream branch: 5ee8dbf
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from a152354 to 76a44a7 Compare March 5, 2026 21:45
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 901a429 to 1f19ba6 Compare March 10, 2026 06:29
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 10, 2026

Upstream branch: 1f318b9
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from 76a44a7 to fe65ef4 Compare March 10, 2026 06:35
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 1f19ba6 to e79276a Compare March 11, 2026 08:02
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 11, 2026

Upstream branch: None
series: https://patchwork.kernel.org/project/linux-block/list/?series=1060459
version: 5

… on RT

In RT kernel (PREEMPT_RT), commit 6bda857 ("block: fix ordering
between checking QUEUE_FLAG_QUIESCED request adding") causes severe
performance regression on systems with multiple MSI-X interrupt
vectors.

The above change introduced spinlock_t queue_lock usage in
blk_mq_run_hw_queue() to synchronize QUEUE_FLAG_QUIESCED checks
with blk_mq_unquiesce_queue(). While this works correctly in
standard kernel, it causes catastrophic serialization in RT kernel
where spinlock_t converts to sleeping rt_mutex.

Problem in RT kernel:
- blk_mq_run_hw_queue() is called from IRQ thread context
- With multiple MSI-X vectors, all IRQ threads contend on
  the same queue_lock
- queue_lock becomes rt_mutex (sleeping) in RT kernel
- IRQ threads serialize and enter D-state waiting for lock
- Throughput drops from 640 MB/s to 153 MB/s

Solution:
Convert quiesce_depth to atomic_t and use it directly for quiesce
state checking, eliminating QUEUE_FLAG_QUIESCED entirely. This
removes the need for any locking in the hot path.

The atomic counter serves as both the depth tracker and the quiesce
indicator (depth > 0 means quiesced). This eliminates the race
window that existed between updating the depth and the flag.

Memory ordering is ensured by:
- smp_mb__after_atomic() after modifying quiesce_depth
- smp_rmb() before re-checking quiesce state in
  blk_mq_run_hw_queue()

Performance impact:
- RT kernel: eliminates lock contention, restores full throughput
- Non-RT kernel: atomic ops are similar cost to the previous
  spinlock acquire/release, no regression expected

Test results on RT kernel:
Hardware: Broadcom/LSI MegaRAID 12GSAS/PCIe Secure SAS39xx
  (megaraid_sas driver, 128 MSI-X vectors, 120 hw queues)
- Before: 153 MB/s, IRQ threads in D-state
- After:  640 MB/s, no IRQ threads blocked

Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: 6bda857 ("block: fix ordering between checking QUEUE_FLAG_QUIESCED request adding")
Cc: stable@vger.kernel.org
Signed-off-by: Ionut Nechita <ionut.nechita@windriver.com>
@blktests-ci blktests-ci bot force-pushed the series/1053247=>linus-master branch from fe65ef4 to 09b0064 Compare March 11, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant