From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
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 V2 3/3] blk-mq: dequeue request one by one from sw queue iff hctx is busy
Date: Fri, 29 Jun 2018 10:39:44 +0200 [thread overview]
Message-ID: <20180629083944.GE15870@lst.de> (raw)
In-Reply-To: <20180629081252.13836-4-ming.lei@redhat.com>
> +/* update queue busy with EWMA (7/8 * ewma(t) + 1/8 * busy(t + 1)) */
> +static void blk_mq_update_hctx_busy(struct blk_mq_hw_ctx *hctx, unsigned int busy)
Overly long line. Also busy really is a bool, so I think we should
pass it as such.
Also I think this needs a much better comment describing why we
are using this algorith. Also expanding the EWMA acronym would help,
I had to look it up first.
> + const unsigned weight = 8;
> + const unsigned factor = 4;
Where do these magic constants come from?
> + unsigned int ewma;
> +
> + if (hctx->queue->elevator)
> + return;
> +
> + ewma = READ_ONCE(hctx->busy);
> +
> + ewma *= weight - 1;
> + ewma += busy << factor;
With the bool parameter and expanding the "factor" which really is
a shift value this would be:
if (busy)
ewma += 16;
which at least is a little more understandable, although still not
great.
next prev parent reply other threads:[~2018-06-29 8:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 8:12 [PATCH V2 0/3] blk-mq: improve IO perf in case of none io sched Ming Lei
2018-06-29 8:12 ` [PATCH V2 1/3] blk-mq: use list_splice_tail_init() to insert requests Ming Lei
2018-06-29 8:34 ` Christoph Hellwig
2018-06-29 8:12 ` [PATCH V2 2/3] blk-mq: only attempt to merge bio if there is rq in sw queue Ming Lei
2018-06-29 8:35 ` Christoph Hellwig
2018-06-29 8:12 ` [PATCH V2 3/3] blk-mq: dequeue request one by one from sw queue iff hctx is busy Ming Lei
2018-06-29 8:39 ` Christoph Hellwig [this message]
2018-06-29 15:24 ` Ming Lei
2018-06-29 14:58 ` Jens Axboe
2018-06-29 15:34 ` Ming Lei
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=20180629083944.GE15870@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=hare@suse.de \
--cc=kashyap.desai@broadcom.com \
--cc=linux-block@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=ming.lei@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.