public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Alexander Gordeev <agordeev@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] blk-mq: Fix formula to calculate fair share of tags
Date: Wed, 03 Sep 2014 14:43:13 -0600	[thread overview]
Message-ID: <54077D61.3030707@kernel.dk> (raw)
In-Reply-To: <e8d8cf4c5c0491eabb6d1dba6fd44a3964837132.1409775956.git.agordeev@redhat.com>

On 09/03/2014 02:33 PM, Alexander Gordeev wrote:
> Fair share of tags is number of tags diveded on number
> of users. Not sure why it is different.
> 
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> ---
>  block/blk-mq-tag.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index d1eb579..1b9c949 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -127,7 +127,7 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
>  	/*
>  	 * Allow at least some tags
>  	 */
> -	depth = max((bt->depth + users - 1) / users, 4U);
> +	depth = max(bt->depth / users, 4U);
>  	return atomic_read(&hctx->nr_active) < depth;

It's normal rounding, you'll round down otherwise. Say you have a tag
depth of 31 (SATA), and 4 active users. Your change would make that 7
tags per user, leaving 3 idle. If you round up, you end up with 8 tags
instead. That will potentially just leave some sleeping for a new tag,
but at least you'll exhaust the space.

-- 
Jens Axboe


      reply	other threads:[~2014-09-03 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 20:33 [PATCH 0/3] blk-mq: Minor tweaks Alexander Gordeev
2014-09-03 20:33 ` [PATCH 1/3] blk-mq: Cleanup blk_mq_tag_busy() and blk_mq_tag_idle() Alexander Gordeev
2014-09-03 20:35   ` Jens Axboe
2014-09-05  1:26     ` Chuck Ebbert
2014-09-05  1:30       ` Jens Axboe
2014-09-05  1:58         ` Chuck Ebbert
2014-09-03 20:33 ` [PATCH 2/3] blk-mq: Eliminate superfluous check of BLK_MQ_S_TAG_ACTIVE flag Alexander Gordeev
2014-09-03 20:40   ` Jens Axboe
2014-09-03 20:33 ` [PATCH 3/3] blk-mq: Fix formula to calculate fair share of tags Alexander Gordeev
2014-09-03 20:43   ` Jens Axboe [this message]

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=54077D61.3030707@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=agordeev@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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