lkml.org 
[lkml]   [2017]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V5 6/7] blk-mq-sched: improve dispatching from sw queue
On Tue, Oct 03, 2017 at 02:05:27AM -0700, Christoph Hellwig wrote:
> On Sat, Sep 30, 2017 at 06:27:19PM +0800, Ming Lei wrote:
> > SCSI devices use host-wide tagset, and the shared
> > driver tag space is often quite big. Meantime
> > there is also queue depth for each lun(.cmd_per_lun),
> > which is often small.
> >
> > So lots of requests may stay in sw queue, and we
> > always flush all belonging to same hw queue and
> > dispatch them all to driver, unfortunately it is
> > easy to cause queue busy because of the small
> > per-lun queue depth. Once these requests are flushed
> > out, they have to stay in hctx->dispatch, and no bio
> > merge can participate into these requests, and
> > sequential IO performance is hurted.
> >
> > This patch improves dispatching from sw queue when
> > there is per-request-queue queue depth by taking
> > request one by one from sw queue, just like the way
> > of IO scheduler.
>
> Once again, use your line length real estate for your change logs..

OK.

>
> > +static void blk_mq_do_dispatch_ctx(struct request_queue *q,
> > + struct blk_mq_hw_ctx *hctx)
> > +{
> > + LIST_HEAD(rq_list);
> > + struct blk_mq_ctx *ctx = READ_ONCE(hctx->dispatch_from);
> > + bool dispatched;
> > +
> > + do {
> > + struct request *rq;
> > +
> > + rq = blk_mq_dequeue_from_ctx(hctx, ctx);
>
> This probably should be merged wit hthe patch that introduceѕ
> blk_mq_dequeue_from_ctx.

OK.

>
> > + if (!rq)
> > + break;
> > + list_add(&rq->queuelist, &rq_list);
>
> Btw, do we really need to return a request from blk_mq_dequeue_from_ctx,
> or would it be easier to just add it directly to the list passed as
> an argument. I did wonder that about the existing code already.

I suggest to keep them as current way in this patch, but we can clean
them up all in another patch.

>
> > +
> > + /* round robin for fair dispatch */
> > + ctx = blk_mq_next_ctx(hctx, rq->mq_ctx);
> > +
> > + dispatched = blk_mq_dispatch_rq_list(q, &rq_list);
> > + } while (dispatched);
> > +
> > + if (!dispatched)
> > + WRITE_ONCE(hctx->dispatch_from, ctx);
>
> No need for the dispatched argument, just write this as:
>
> } while (blk_mq_dispatch_rq_list(q, &rq_list));
>
> WRITE_ONCE(hctx->dispatch_from, ctx);
>
> and do an early return instead of a break from inside the loop.

OK.

>
> > + } else if (!has_sched_dispatch && !q->queue_depth) {
> > + /*
> > + * If there is no per-request_queue depth, we
> > + * flush all requests in this hw queue, otherwise
> > + * pick up request one by one from sw queue for
> > + * avoiding to mess up I/O merge when dispatch
> > + * run out of resource, which can be triggered
> > + * easily by per-request_queue queue depth
> > + */
>
> Use your 80 line real estate for comments..

OK.

--
Ming

\
 
 \ /
  Last update: 2017-10-09 12:15    [W:0.085 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site