public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, linux-kernel@vger.kernel.org
Cc: Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH 3/5] blk-mq: bitmap tag: select random tag betweet 0 and (depth - 1)
Date: Sun, 11 May 2014 01:01:50 +0800	[thread overview]
Message-ID: <1399741312-10453-4-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1399741312-10453-1-git-send-email-tom.leiming@gmail.com>

The selected tag should be selected at random between 0 and
(depth - 1) with probability 1/depth, instead between 0 and
(depth - 2) with probability 1/(depth - 1).

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 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 777aad7..77d2b18 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -427,7 +427,7 @@ void blk_mq_tag_init_last_tag(struct blk_mq_tags *tags, unsigned int *tag)
 {
 	unsigned int depth = tags->nr_tags - tags->nr_reserved_tags;
 
-	*tag = prandom_u32() % (depth - 1);
+	*tag = prandom_u32() % depth;
 }
 
 ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page)
-- 
1.7.9.5


  parent reply	other threads:[~2014-05-10 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-10 17:01 [PATCH 0/5] blk-mq: bitmap tag: fix and cleanup Ming Lei
2014-05-10 17:01 ` [PATCH 1/5] blk-mq: bitmap tag: use clear_bit_unlock in bt_clear_tag() Ming Lei
2014-05-10 17:01 ` [PATCH 2/5] blk-mq: bitmap tag: remove barrier " Ming Lei
2014-05-10 17:01 ` Ming Lei [this message]
2014-05-10 17:01 ` [PATCH 4/5] blk-mq: bitmap tag: cleanup blk_mq_init_tags Ming Lei
2014-05-10 17:01 ` [PATCH 5/5] blk-mq: bitmap tag: fix wait batch for allocation Ming Lei
2014-05-10 19:39 ` [PATCH 0/5] blk-mq: bitmap tag: fix and cleanup Jens Axboe
2014-05-11  1:13   ` 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=1399741312-10453-4-git-send-email-tom.leiming@gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=axboe@kernel.dk \
    --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