Skip to content

Commit 5ac83c6

Browse files
jankaraaxboe
authored andcommitted
Revert "blk-mq, elevator: Count requests per hctx to improve performance"
This reverts commit b445547. Since both mq-deadline and BFQ completely ignore hctx they are passed to their dispatch function and dispatch whatever request they deem fit checking whether any request for a particular hctx is queued is just pointless since we'll very likely get a request from a different hctx anyway. In the following commit we'll deal with lock contention in these IO schedulers in presence of multiple HW queues in a different way. Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 2391d13 commit 5ac83c6

File tree

4 files changed

+0
-16
lines changed

4 files changed

+0
-16
lines changed

block/bfq-iosched.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4677,9 +4677,6 @@ static bool bfq_has_work(struct blk_mq_hw_ctx *hctx)
46774677
{
46784678
struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;
46794679

4680-
if (!atomic_read(&hctx->elevator_queued))
4681-
return false;
4682-
46834680
/*
46844681
* Avoiding lock: a race on bfqd->busy_queues should cause at
46854682
* most a call to dispatch for nothing
@@ -5597,7 +5594,6 @@ static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx,
55975594
rq = list_first_entry(list, struct request, queuelist);
55985595
list_del_init(&rq->queuelist);
55995596
bfq_insert_request(hctx, rq, at_head);
5600-
atomic_inc(&hctx->elevator_queued);
56015597
}
56025598
}
56035599

@@ -5965,7 +5961,6 @@ static void bfq_finish_requeue_request(struct request *rq)
59655961

59665962
bfq_completed_request(bfqq, bfqd);
59675963
bfq_finish_requeue_request_body(bfqq);
5968-
atomic_dec(&rq->mq_hctx->elevator_queued);
59695964

59705965
spin_unlock_irqrestore(&bfqd->lock, flags);
59715966
} else {

block/blk-mq.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,6 @@ blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set,
26532653
goto free_hctx;
26542654

26552655
atomic_set(&hctx->nr_active, 0);
2656-
atomic_set(&hctx->elevator_queued, 0);
26572656
if (node == NUMA_NO_NODE)
26582657
node = set->numa_node;
26592658
hctx->numa_node = node;

block/mq-deadline.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,6 @@ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
386386
spin_lock(&dd->lock);
387387
rq = __dd_dispatch_request(dd);
388388
spin_unlock(&dd->lock);
389-
if (rq)
390-
atomic_dec(&rq->mq_hctx->elevator_queued);
391389

392390
return rq;
393391
}
@@ -535,7 +533,6 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
535533
rq = list_first_entry(list, struct request, queuelist);
536534
list_del_init(&rq->queuelist);
537535
dd_insert_request(hctx, rq, at_head);
538-
atomic_inc(&hctx->elevator_queued);
539536
}
540537
spin_unlock(&dd->lock);
541538
}
@@ -582,9 +579,6 @@ static bool dd_has_work(struct blk_mq_hw_ctx *hctx)
582579
{
583580
struct deadline_data *dd = hctx->queue->elevator->elevator_data;
584581

585-
if (!atomic_read(&hctx->elevator_queued))
586-
return false;
587-
588582
return !list_empty_careful(&dd->dispatch) ||
589583
!list_empty_careful(&dd->fifo_list[0]) ||
590584
!list_empty_careful(&dd->fifo_list[1]);

include/linux/blk-mq.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ struct blk_mq_hw_ctx {
140140
* shared across request queues.
141141
*/
142142
atomic_t nr_active;
143-
/**
144-
* @elevator_queued: Number of queued requests on hctx.
145-
*/
146-
atomic_t elevator_queued;
147143

148144
/** @cpuhp_online: List to store request if CPU is going to die */
149145
struct hlist_node cpuhp_online;

0 commit comments

Comments
 (0)