aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-mq-tag.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-05-09 15:41:15 -0400
committerJens Axboe <axboe@fb.com>2014-05-09 15:41:15 -0400
commit59d13bf5f57ded658c872fa22276f75ab8f12841 (patch)
treeea3b3bf9395c01a5443c2e01874837a19d6e4c62 /block/blk-mq-tag.h
parent4bb659b156996f2993dc16fad71fec9ee070153c (diff)
blk-mq: use sparser tag layout for lower queue depth
For best performance, spreading tags over multiple cachelines makes the tagging more efficient on multicore systems. But since we have 8 * sizeof(unsigned long) tags per cacheline, we don't always get a nice spread. Attempt to spread the tags over at least 4 cachelines, using fewer number of bits per unsigned long if we have to. This improves tagging performance in setups with 32-128 tags. For higher depths, the spread is the same as before (BITS_PER_LONG tags per cacheline). Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq-tag.h')
-rw-r--r--block/blk-mq-tag.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h
index 06d4a2f0f7a0..7aa9f0665489 100644
--- a/block/blk-mq-tag.h
+++ b/block/blk-mq-tag.h
@@ -11,8 +11,8 @@ struct bt_wait_state {
11 wait_queue_head_t wait; 11 wait_queue_head_t wait;
12} ____cacheline_aligned_in_smp; 12} ____cacheline_aligned_in_smp;
13 13
14#define TAG_TO_INDEX(tag) ((tag) / BITS_PER_LONG) 14#define TAG_TO_INDEX(bt, tag) ((tag) >> (bt)->bits_per_word)
15#define TAG_TO_BIT(tag) ((tag) & (BITS_PER_LONG - 1)) 15#define TAG_TO_BIT(bt, tag) ((tag) & ((1 << (bt)->bits_per_word) - 1))
16 16
17struct blk_mq_bitmap { 17struct blk_mq_bitmap {
18 unsigned long word; 18 unsigned long word;
@@ -22,9 +22,10 @@ struct blk_mq_bitmap {
22struct blk_mq_bitmap_tags { 22struct blk_mq_bitmap_tags {
23 unsigned int depth; 23 unsigned int depth;
24 unsigned int wake_cnt; 24 unsigned int wake_cnt;
25 unsigned int bits_per_word;
25 26
26 struct blk_mq_bitmap *map;
27 unsigned int map_nr; 27 unsigned int map_nr;
28 struct blk_mq_bitmap *map;
28 29
29 unsigned int wake_index; 30 unsigned int wake_index;
30 struct bt_wait_state *bs; 31 struct bt_wait_state *bs;