All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Robert Elliott <relliott@beardog.cce.hp.com>,
	elliott@hp.com, hch@lst.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] block: return error if too many reserved tags are requested
Date: Wed, 10 Sep 2014 12:17:37 -0600	[thread overview]
Message-ID: <541095C1.2040500@kernel.dk> (raw)
In-Reply-To: <20140910001806.9294.35884.stgit@beardog.cce.hp.com>

On 09/09/2014 06:18 PM, Robert Elliott wrote:
> From: Robert Elliott <elliott@hp.com>
> 
> Make blk_mq_alloc_tag_set return an error if set->reserved_tags
> is greater than BLK_MQ_MAX_DEPTH minus the minimum number of
> tags, since:
> * set->queue_depth is truncated to that value
> * set->reserved_tags needs to be less than set->queue_depth
> 
> Signed-off-by: Robert Elliott <elliott@hp.com>
> ---
>  block/blk-mq.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index c49fe00..dc2970d 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1936,16 +1936,18 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
>  		return -EINVAL;
>  	if (!set->queue_depth)
>  		return -EINVAL;
> +	if (set->reserved_tags > BLK_MQ_MAX_DEPTH - BLK_MQ_TAG_MIN)
> +		return -EINVAL;
>  	if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN)
>  		return -EINVAL;
>  
>  	if (!set->nr_hw_queues || !set->ops->queue_rq || !set->ops->map_queue)
>  		return -EINVAL;
>  
> -	if (set->queue_depth > BLK_MQ_MAX_DEPTH) {
> +	if (set->queue_depth > BLK_MQ_MAX_DEPTH - set->reserved_tags) {

This is harder to read than:

	if (set->queue_depth + set->reserved_tags > BLK_MQ_MAX_DEPTH) {

which more clearly expresses the same thing. But set->queue_depth is the
total pool, reserved tags come out of that pool. So I don't think this
is correct.

-- 
Jens Axboe


      reply	other threads:[~2014-09-10 18:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  0:17 [PATCH 0/2] block: rq_affinity default and reserved tag limits Robert Elliott
2014-09-10  0:18 ` [PATCH 1/2] block: default to rq_affinity=2 for blk-mq Robert Elliott
2014-09-10 18:14   ` Jens Axboe
2014-09-10 19:35     ` Elliott, Robert (Server Storage)
2014-09-10 19:51       ` Jens Axboe
2014-09-10  0:18 ` [PATCH 2/2] block: return error if too many reserved tags are requested Robert Elliott
2014-09-10 18:17   ` 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=541095C1.2040500@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=elliott@hp.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=relliott@beardog.cce.hp.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.