summaryrefslogtreecommitdiffstats
path: root/include/linux/blk-mq.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-05-09 09:36:49 -0600
committerJens Axboe <axboe@fb.com>2014-05-09 09:36:49 -0600
commit4bb659b156996f2993dc16fad71fec9ee070153c (patch)
treebaff4b0882edfc01f082b321e7924674a0fe1e90 /include/linux/blk-mq.h
parentaf76e555e5e29e08eb8ac1f7878e23dbf0d6741f (diff)
downloadlinux-4bb659b156996f2993dc16fad71fec9ee070153c.tar.gz
linux-4bb659b156996f2993dc16fad71fec9ee070153c.tar.bz2
linux-4bb659b156996f2993dc16fad71fec9ee070153c.zip
blk-mq: implement new and more efficient tagging scheme
blk-mq currently uses percpu_ida for tag allocation. But that only works well if the ratio between tag space and number of CPUs is sufficiently high. For most devices and systems, that is not the case. The end result if that we either only utilize the tag space partially, or we end up attempting to fully exhaust it and run into lots of lock contention with stealing between CPUs. This is not optimal. This new tagging scheme is a hybrid bitmap allocator. It uses two tricks to both be SMP friendly and allow full exhaustion of the space: 1) We cache the last allocated (or freed) tag on a per blk-mq software context basis. This allows us to limit the space we have to search. The key element here is not caching it in the shared tag structure, otherwise we end up dirtying more shared cache lines on each allocate/free operation. 2) The tag space is split into cache line sized groups, and each context will start off randomly in that space. Even up to full utilization of the space, this divides the tag users efficiently into cache line groups, avoiding dirtying the same one both between allocators and between allocator and freeer. This scheme shows drastically better behaviour, both on small tag spaces but on large ones as well. It has been tested extensively to show better performance for all the cases blk-mq cares about. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r--include/linux/blk-mq.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 5bd677e2dcb7..f83d15f6e1c1 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -31,10 +31,12 @@ struct blk_mq_hw_ctx {
void *driver_data;
- unsigned int nr_ctx;
- struct blk_mq_ctx **ctxs;
unsigned int nr_ctx_map;
unsigned long *ctx_map;
+ unsigned int nr_ctx;
+ struct blk_mq_ctx **ctxs;
+
+ unsigned int wait_index;
struct blk_mq_tags *tags;