|
|
Subscribe / Log in / New account

blk-mq: Replace tags->lock with SRCU for tag iterators

From:  Ming Lei <ming.lei-AT-redhat.com>
To:  Jens Axboe <axboe-AT-kernel.dk>, linux-block-AT-vger.kernel.org
Subject:  [PATCH 0/5] blk-mq: Replace tags->lock with SRCU for tag iterators
Date:  Fri, 01 Aug 2025 19:44:32 +0800
Message-ID:  <20250801114440.722286-1-ming.lei@redhat.com>
Cc:  Yu Kuai <yukuai3-AT-huawei.com>, John Garry <john.garry-AT-huawei.com>, Sathya Prakash Veerichetty <sathya.prakash-AT-broadcom.com>, Ming Lei <ming.lei-AT-redhat.com>
Archive-link:  Article

Hello Jens,

Replace the spinlock in blk_mq_find_and_get_req() with an SRCU read lock
around the tag iterators.

Avoids scsi_host_busy() lockup during scsi host blocked  in case of big cpu
cores & deep queue depth.

Also it becomes possible to use blk_mq_in_driver_rw() for io accounting now.

Take the following approach:

- clearing rq reference in tags->rqs[] and deferring freeing scheduler requests
in SRCU callback

- replace tags->lock with srcu read lock in tags iterator.


Ming Lei (5):
  blk-mq: Move flush queue allocation into blk_mq_init_hctx()
  blk-mq: Pass tag_set to blk_mq_free_rq_map/tags
  blk-mq: Defer freeing of tags page_list to SRCU callback
  blk-mq: Defer freeing flush queue to SRCU callback
  blk-mq: Replace tags->lock with SRCU for tag iterators

 block/blk-mq-sched.c   |  4 +-
 block/blk-mq-sysfs.c   |  1 -
 block/blk-mq-tag.c     | 38 +++++++++++++++---
 block/blk-mq.c         | 87 +++++++++++++++++++++---------------------
 block/blk-mq.h         |  4 +-
 block/blk.h            |  1 +
 include/linux/blk-mq.h |  2 +
 7 files changed, 82 insertions(+), 55 deletions(-)

-- 
2.47.0




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds