Skip to content

Commit

Permalink
Revert "blk-mq, elevator: Count requests per hctx to improve performa…
Browse files Browse the repository at this point in the history
…nce"

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]>
  • Loading branch information
jankara authored and axboe committed Jan 25, 2021
1 parent 2391d13 commit 5ac83c6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 16 deletions.
5 changes: 0 additions & 5 deletions block/bfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4677,9 +4677,6 @@ static bool bfq_has_work(struct blk_mq_hw_ctx *hctx)
{
struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;

if (!atomic_read(&hctx->elevator_queued))
return false;

/*
* Avoiding lock: a race on bfqd->busy_queues should cause at
* most a call to dispatch for nothing
Expand Down Expand Up @@ -5597,7 +5594,6 @@ static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx,
rq = list_first_entry(list, struct request, queuelist);
list_del_init(&rq->queuelist);
bfq_insert_request(hctx, rq, at_head);
atomic_inc(&hctx->elevator_queued);
}
}

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

bfq_completed_request(bfqq, bfqd);
bfq_finish_requeue_request_body(bfqq);
atomic_dec(&rq->mq_hctx->elevator_queued);

spin_unlock_irqrestore(&bfqd->lock, flags);
} else {
Expand Down
1 change: 0 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2653,7 +2653,6 @@ blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set,
goto free_hctx;

atomic_set(&hctx->nr_active, 0);
atomic_set(&hctx->elevator_queued, 0);
if (node == NUMA_NO_NODE)
node = set->numa_node;
hctx->numa_node = node;
Expand Down
6 changes: 0 additions & 6 deletions block/mq-deadline.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
spin_lock(&dd->lock);
rq = __dd_dispatch_request(dd);
spin_unlock(&dd->lock);
if (rq)
atomic_dec(&rq->mq_hctx->elevator_queued);

return rq;
}
Expand Down Expand Up @@ -535,7 +533,6 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
rq = list_first_entry(list, struct request, queuelist);
list_del_init(&rq->queuelist);
dd_insert_request(hctx, rq, at_head);
atomic_inc(&hctx->elevator_queued);
}
spin_unlock(&dd->lock);
}
Expand Down Expand Up @@ -582,9 +579,6 @@ static bool dd_has_work(struct blk_mq_hw_ctx *hctx)
{
struct deadline_data *dd = hctx->queue->elevator->elevator_data;

if (!atomic_read(&hctx->elevator_queued))
return false;

return !list_empty_careful(&dd->dispatch) ||
!list_empty_careful(&dd->fifo_list[0]) ||
!list_empty_careful(&dd->fifo_list[1]);
Expand Down
4 changes: 0 additions & 4 deletions include/linux/blk-mq.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ struct blk_mq_hw_ctx {
* shared across request queues.
*/
atomic_t nr_active;
/**
* @elevator_queued: Number of queued requests on hctx.
*/
atomic_t elevator_queued;

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

0 comments on commit 5ac83c6

Please sign in to comment.