public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: sbates@raithlin.com
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	Damien.LeMoal@wdc.com, osandov@osandov.com, sagi@grimberg.me
Subject: Re: [PATCH v2 2/2] blk-mq: Add a polling specific stats function
Date: Wed, 5 Apr 2017 12:14:33 -0600	[thread overview]
Message-ID: <370c8854-1735-b0e7-089f-4b04068ca4f1@kernel.dk> (raw)
In-Reply-To: <1491413957-30885-3-git-send-email-sbates@raithlin.com>

On 04/05/2017 11:39 AM, sbates@raithlin.com wrote:
> @@ -42,6 +42,33 @@ static LIST_HEAD(all_q_list);
>  static void blk_mq_poll_stats_start(struct request_queue *q);
>  static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb);
>  
> +static int blk_mq_poll_stats_bkt(const struct request *rq)
> +{
> +	int dir, bytes;
> +
> +	dir = blk_stat_rq_ddir(rq);
> +	bytes = blk_rq_bytes(rq);
> +
> +	if (bytes <= 512)
> +		return dir;
> +	else if (bytes <= 4096)
> +		return dir + 2;
> +	else if (bytes <= 8192)
> +		return dir + 4;
> +	else if (bytes <= 16384)
> +		return dir + 6;
> +	else if (bytes <= 32768)
> +		return dir + 8;
> +	else if (bytes <= 65536)
> +		return dir + 10;
> +	else
> +		return dir + 12;

Why not just have 8 buckets, and make it:

	bucket = ddir + ilog2(bytes) - 9;

and cap it at MAX_BUCKET (8) and put all those above into the top
bucket.

-- 
Jens Axboe

  reply	other threads:[~2017-04-05 18:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 17:39 [PATCH v2 0/2] blk-stat: Add ability to not bucket IO; improve IO polling sbates
2017-04-05 17:39 ` [PATCH v2 1/2] blk-stat: convert blk-stat bucket callback to signed sbates
2017-04-05 17:39 ` [PATCH v2 2/2] blk-mq: Add a polling specific stats function sbates
2017-04-05 18:14   ` Jens Axboe [this message]
2017-04-07 12:11     ` Stephen  Bates
2017-04-07 14:01       ` 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=370c8854-1735-b0e7-089f-4b04068ca4f1@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Damien.LeMoal@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=osandov@osandov.com \
    --cc=sagi@grimberg.me \
    --cc=sbates@raithlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox