Re: [PATCH V2 3/3] blk-mq: dequeue request one by one from sw queue iff hctx is busy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +/* 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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux