* [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues
@ 2018-01-05 21:56 Jens Axboe
2018-01-05 22:03 ` Omar Sandoval
2018-01-06 8:47 ` Ming Lei
0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2018-01-05 21:56 UTC (permalink / raw)
To: linux-block@vger.kernel.org; +Cc: Omar Sandoval
Don't pass in the hardware queue to __dd_dispatch_request(), since it
leads the reader to believe that we are returning a request for that
specific hardware queue. That's not how mq-deadline works, the state
for determining which request to serve next is shared across all
hardware queues for a device.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index d56972e8ebda..c56f211c8440 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -267,9 +267,8 @@ deadline_next_request(struct deadline_data *dd, int data_dir)
* deadline_dispatch_requests selects the best request according to
* read/write expire, fifo_batch, etc
*/
-static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
+static struct request *__dd_dispatch_request(struct deadline_data *dd)
{
- struct deadline_data *dd = hctx->queue->elevator->elevator_data;
struct request *rq, *next_rq;
bool reads, writes;
int data_dir;
@@ -372,13 +371,19 @@ static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
return rq;
}
+/*
+ * One confusing aspect here is that we get called for a specific
+ * hardware queue, but we return a request that may not be for a
+ * different hardware queue. This is because mq-deadline has shared
+ * state for all hardware queues, in terms of sorting, FIFOs, etc.
+ */
static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
{
struct deadline_data *dd = hctx->queue->elevator->elevator_data;
struct request *rq;
spin_lock(&dd->lock);
- rq = __dd_dispatch_request(hctx);
+ rq = __dd_dispatch_request(dd);
spin_unlock(&dd->lock);
return rq;
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues
2018-01-05 21:56 [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues Jens Axboe
@ 2018-01-05 22:03 ` Omar Sandoval
2018-01-06 8:47 ` Ming Lei
1 sibling, 0 replies; 3+ messages in thread
From: Omar Sandoval @ 2018-01-05 22:03 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block@vger.kernel.org
On Fri, Jan 05, 2018 at 02:56:38PM -0700, Jens Axboe wrote:
> Don't pass in the hardware queue to __dd_dispatch_request(), since it
> leads the reader to believe that we are returning a request for that
> specific hardware queue. That's not how mq-deadline works, the state
> for determining which request to serve next is shared across all
> hardware queues for a device.
Reviewed-by: Omar Sandoval <osandov@fb.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> ---
>
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index d56972e8ebda..c56f211c8440 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -267,9 +267,8 @@ deadline_next_request(struct deadline_data *dd, int data_dir)
> * deadline_dispatch_requests selects the best request according to
> * read/write expire, fifo_batch, etc
> */
> -static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
> +static struct request *__dd_dispatch_request(struct deadline_data *dd)
> {
> - struct deadline_data *dd = hctx->queue->elevator->elevator_data;
> struct request *rq, *next_rq;
> bool reads, writes;
> int data_dir;
> @@ -372,13 +371,19 @@ static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
> return rq;
> }
>
> +/*
> + * One confusing aspect here is that we get called for a specific
> + * hardware queue, but we return a request that may not be for a
> + * different hardware queue. This is because mq-deadline has shared
> + * state for all hardware queues, in terms of sorting, FIFOs, etc.
> + */
> static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
> {
> struct deadline_data *dd = hctx->queue->elevator->elevator_data;
> struct request *rq;
>
> spin_lock(&dd->lock);
> - rq = __dd_dispatch_request(hctx);
> + rq = __dd_dispatch_request(dd);
> spin_unlock(&dd->lock);
>
> return rq;
>
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues
2018-01-05 21:56 [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues Jens Axboe
2018-01-05 22:03 ` Omar Sandoval
@ 2018-01-06 8:47 ` Ming Lei
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2018-01-06 8:47 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block@vger.kernel.org, Omar Sandoval
On Fri, Jan 05, 2018 at 02:56:38PM -0700, Jens Axboe wrote:
> Don't pass in the hardware queue to __dd_dispatch_request(), since it
> leads the reader to believe that we are returning a request for that
> specific hardware queue. That's not how mq-deadline works, the state
> for determining which request to serve next is shared across all
> hardware queues for a device.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
--
Ming
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-06 8:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 21:56 [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues Jens Axboe
2018-01-05 22:03 ` Omar Sandoval
2018-01-06 8:47 ` Ming Lei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox