* [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator
@ 2025-05-15 13:44 Nilay Shroff
2025-05-15 18:14 ` Jens Axboe
2025-05-16 1:04 ` Ming Lei
0 siblings, 2 replies; 3+ messages in thread
From: Nilay Shroff @ 2025-05-15 13:44 UTC (permalink / raw)
To: linux-block; +Cc: ming.lei, hch, hare, axboe, gjoyce
When nr_hw_queues is updated, the elevator needs to be switched to
ensure that we exit elevator and reattach it to ensure that hctx->
sched_tags is correctly allocated for the new hardware queues.
However, elv_update_nr_hw_queues() currently only switches the
elevator if the queue is not registered. This is incorrect, as it
prevents reattaching the elevator after updating nr_hw_queues, which
in turn inhibits allocation of sched_tags.
Fix this by allowing the elevator switch if the queue is registered,
ensuring proper reattachment and resource allocation.
Fixes: 596dce110b7d ("block: simplify elevator reattachment for updating nr_hw_queues")
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
---
block/elevator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/elevator.c b/block/elevator.c
index f8d72bd20610..ab22542e6cf0 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -697,7 +697,7 @@ void elv_update_nr_hw_queues(struct request_queue *q)
WARN_ON_ONCE(q->mq_freeze_depth == 0);
mutex_lock(&q->elevator_lock);
- if (q->elevator && !blk_queue_dying(q) && !blk_queue_registered(q)) {
+ if (q->elevator && !blk_queue_dying(q) && blk_queue_registered(q)) {
ctx.name = q->elevator->type->elevator_name;
/* force to reattach elevator after nr_hw_queue is updated */
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator
2025-05-15 13:44 [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator Nilay Shroff
@ 2025-05-15 18:14 ` Jens Axboe
2025-05-16 1:04 ` Ming Lei
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-05-15 18:14 UTC (permalink / raw)
To: linux-block, Nilay Shroff; +Cc: ming.lei, hch, hare, gjoyce
On Thu, 15 May 2025 19:14:39 +0530, Nilay Shroff wrote:
> When nr_hw_queues is updated, the elevator needs to be switched to
> ensure that we exit elevator and reattach it to ensure that hctx->
> sched_tags is correctly allocated for the new hardware queues.
> However, elv_update_nr_hw_queues() currently only switches the
> elevator if the queue is not registered. This is incorrect, as it
> prevents reattaching the elevator after updating nr_hw_queues, which
> in turn inhibits allocation of sched_tags.
>
> [...]
Applied, thanks!
[1/1] block: fix elv_update_nr_hw_queues() to reattach elevator
commit: 532b9e11b8540eb543ebec9cba851c5691e10b5b
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator
2025-05-15 13:44 [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator Nilay Shroff
2025-05-15 18:14 ` Jens Axboe
@ 2025-05-16 1:04 ` Ming Lei
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2025-05-16 1:04 UTC (permalink / raw)
To: Nilay Shroff; +Cc: linux-block, hch, hare, axboe, gjoyce
On Thu, May 15, 2025 at 9:45 PM Nilay Shroff <nilay@linux.ibm.com> wrote:
>
> When nr_hw_queues is updated, the elevator needs to be switched to
> ensure that we exit elevator and reattach it to ensure that hctx->
> sched_tags is correctly allocated for the new hardware queues.
> However, elv_update_nr_hw_queues() currently only switches the
> elevator if the queue is not registered. This is incorrect, as it
> prevents reattaching the elevator after updating nr_hw_queues, which
> in turn inhibits allocation of sched_tags.
>
> Fix this by allowing the elevator switch if the queue is registered,
> ensuring proper reattachment and resource allocation.
>
> Fixes: 596dce110b7d ("block: simplify elevator reattachment for updating nr_hw_queues")
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-16 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15 13:44 [PATCH] block: fix elv_update_nr_hw_queues() to reattach elevator Nilay Shroff
2025-05-15 18:14 ` Jens Axboe
2025-05-16 1:04 ` Ming Lei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox