All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Laurence Oberman <loberman@redhat.com>,
	Omar Sandoval <osandov@fb.com>, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bart.vanassche@wdc.com>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH V4] blk-mq: dequeue request one by one from sw queue iff hctx is busy
Date: Tue, 3 Jul 2018 22:11:07 +0800	[thread overview]
Message-ID: <20180703141106.GA7755@ming.t460p> (raw)
In-Reply-To: <45df84ca-e201-a9e1-543c-ebbf15185d40@kernel.dk>

On Tue, Jul 03, 2018 at 08:03:23AM -0600, Jens Axboe wrote:
> On 7/3/18 2:34 AM, Ming Lei wrote:
> > It won't be efficient to dequeue request one by one from sw queue,
> > but we have to do that when queue is busy for better merge performance.
> > 
> > This patch takes the Exponential Weighted Moving Average(EWMA) to figure
> > out if queue is busy, then only dequeue request one by one from sw queue
> > when queue is busy.
> 
> I've started to come around to the approach, but can we add something
> that only triggers this busy tracking if we've even seen a BUSY
> condition? Basically, this:
> 
> blk_mq_update_dispatch_busy(hctx, false);
> 
> should be a no-op, if we've never called:
> 
> blk_mq_update_dispatch_busy(hctx, true);
> 
> Something ala the below, with the BLK_MQ_S_EWMA bit added, of course.
> 
> static void __blk_mq_update_dispatch_busy(struct blk_mq_hw_ctx *hctx, bool busy)
> {
> 	unsigned int ewma = READ_ONCE(hctx->dispatch_busy);
> 
> 	ewma *= BLK_MQ_DISPATCH_BUSY_EWMA_WEIGHT - 1;
> 	if (busy)
> 		ewma += 1 << BLK_MQ_DISPATCH_BUSY_EWMA_FACTOR;
> 	ewma /= BLK_MQ_DISPATCH_BUSY_EWMA_WEIGHT;
> 
> 	WRITE_ONCE(hctx->dispatch_busy, ewma);
> }

How about doing it in the following(simpler) way? By adding the check
at the entry of __blk_mq_update_dispatch_busy().

	if (!ewma && !busy)
		return;

Thanks,
Ming

  reply	other threads:[~2018-07-03 14:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  8:34 [PATCH V4] blk-mq: dequeue request one by one from sw queue iff hctx is busy Ming Lei
2018-07-03 14:03 ` Jens Axboe
2018-07-03 14:11   ` Ming Lei [this message]
2018-07-03 14:13     ` Jens Axboe
2018-07-03 14:34       ` Ming Lei
2018-07-03 14:36         ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180703141106.GA7755@ming.t460p \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@wdc.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-block@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=osandov@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.