block: move sched_tags allocation/de-allocation outside of locking context
Status from this message: Applied, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest3 patches 8 repliesApplied
- v73 patches 5 repliesSuperseded
- v63 patches 11 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 3 patches | 1 reply | Superseded | |
| v4 | 3 patches | 4 replies | Superseded | |
| v3 | 2 patches | 11 replies | Superseded |
Changes in v8 from the cover letter
- Rebased code on top of block-6.17, commit 5421681bc3ef ("blk-ioc: don't hold queue_lock for ioc_lookup_icq()")
Link to v7: https://lore.kernel.org/all/[email protected]/
Patches in v8 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | block: move elevator queue allocation logic into blk_mq_init_schedblock/ block/ block/ +3 more | +16 | 0 replies | |
| 2/3 | block: fix lockdep warning caused by lock dependency in elv_iosched_storeblock/ block/ block/ +1 more | +136 | 6 replies | |
| 3/3 | block: fix potential deadlock while running nr_hw_queue updateblock/ block/ block/ +2 more | +89 | 0 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Ming Lei | Christoph Hellwig | Hannes Reinecke |
|---|---|---|---|
| 1/3 | R-b | R-b | R-b |
| 2/3 | R-b | R-b | R-b |
| 3/3 | R-b | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCHv8 0/3] block: move sched_tags allocation/de-allocation outside of locking context
Hi,
There have been a few reports[1] indicating potential lockdep warnings due to a lock dependency from the percpu allocator to the elevator lock. This patch series aims to eliminate that dependency.
The series consists of three patches:
The first patch is preparatory patch and just move elevator queue allocation logic from ->init_sched into blk_mq_init_sched.
The second patch in the series restructures sched_tags allocation and deallocation during elevator update/switch operations to ensure these actions are performed entirely outside the ->freeze_lock and ->elevator_ lock. This eliminates the percpu allocator’s lock dependency on the elevator and freeze lock during scheduler transitions.
The third patch introduces batch allocation and deallocation helpers for sched_tags. These helpers are used during __blk_mq_update_nr_hw_queues() to decouple sched_tags memory management from both the elevator and freeze locks, addressing the lockdep concerns in the nr_hw_queues update path.
[1] https://lore.kernel.org/all/[email protected]/
Changes since v7:
- Rebased code on top of block-6.17, commit 5421681bc3ef ("blk-ioc: don't hold queue_lock for ioc_lookup_icq()")
Link to v7: https://lore.kernel.org/all/[email protected]/
Changes since v6:
- Add warning when loading elevator tags from an xarray yields nothing (Hannes Reinecke)
- Use elevator tags instead of xarray table as a function argument to elv_update_nr_hw_queues (Ming Lei)
Link to v6: https://lore.kernel.org/all/[email protected]/
Changes since v5:
- Fixed smatch warning reported by kernel test robot here:
https://lore.kernel.org/all/[email protected]/
Link to v5: https://lore.kernel.org/all/[email protected]/
Changes since v4:
- Define a local Xarray variable in __blk_mq_update_nr_hw_queues to store sched_tags, instead of storing it in an Xarray defined in 'struct elevator_tags' (Ming Lei)
Link to v4: https://lore.kernel.org/all/[email protected]/
Changes since v3:
- Further split the patchset into three patch series so that we can have a separate patch for sched_tags batch allocation/deallocation (Ming Lei)
- Use Xarray to store and load the sched_tags (Ming Lei)
- Unexport elevator_alloc() as we no longer need to use it outside of block layer core (hch)
- unwind the sched_tags allocation and free tags when we it fails in the middle of allocation (hch)
- Move struct elevator_queue header from commin header to elevator.c as there's no user of it outside elevator.c (Ming Lei, hch)
Link to v3: https://lore.kernel.org/all/[email protected]/
Change since v2:
- Split the patch into a two patch series. The first patch updates ->init_sched elevator API change and second patch handles the sched tags allocation/de-allocation logic (Ming Lei)
- Address sched tags allocation/deallocation logic while running in the context of nr_hw_queue update so that we can handle all possible scenarios in a single patchest (Ming Lei)
Link to v2: https://lore.kernel.org/all/[email protected]/
Changes since v1:
- As the lifetime of elevator queue and sched tags are same, allocate and move sched tags under struct elevator_queue (Ming Lei)
Link to v1: https://lore.kernel.org/all/[email protected]/
Nilay Shroff (3):
block: move elevator queue allocation logic into blk_mq_init_sched
block: fix lockdep warning caused by lock dependency in
elv_iosched_store
block: fix potential deadlock while running nr_hw_queue update
block/bfq-iosched.c | 13 +-- block/blk-mq-sched.c | 223 ++++++++++++++++++++++++++++-------------- block/blk-mq-sched.h | 12 ++- block/blk-mq.c | 16 ++- block/blk.h | 4 +- block/elevator.c | 38 +++++-- block/elevator.h | 16 ++- block/kyber-iosched.c | 11 +-- block/mq-deadline.c | 14 +-- 9 files changed, 228 insertions(+), 119 deletions(-)
Signature · 1 line
2.50.1