diff options
author | Shaohua Li <shli@kernel.org> | 2014-11-30 16:00:58 -0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-11-30 18:35:39 -0700 |
commit | 6637fadf25657e619a50fde5ff3ae09a98d20eb5 (patch) | |
tree | d9d58e0931b82844bcf6783522c02064b8165ca5 /block | |
parent | 70114c393ccaa43ca38e6b36b9469ed2c35acc49 (diff) | |
download | linux-6637fadf25657e619a50fde5ff3ae09a98d20eb5.tar.gz linux-6637fadf25657e619a50fde5ff3ae09a98d20eb5.tar.bz2 linux-6637fadf25657e619a50fde5ff3ae09a98d20eb5.zip |
blk-mq: move the kdump check to blk_mq_alloc_tag_set
We call blk_mq_alloc_tag_set() first then blk_mq_init_queue(). The requests are
allocated in the former function. So the kdump check should be moved to there
to really save memory.
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 27a347fe8f5b..4854e709aa34 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1804,16 +1804,6 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) if (!ctx) return ERR_PTR(-ENOMEM); - /* - * If a crashdump is active, then we are potentially in a very - * memory constrained environment. Limit us to 1 queue and - * 64 tags to prevent using too much memory. - */ - if (is_kdump_kernel()) { - set->nr_hw_queues = 1; - set->queue_depth = min(64U, set->queue_depth); - } - hctxs = kmalloc_node(set->nr_hw_queues * sizeof(*hctxs), GFP_KERNEL, set->numa_node); @@ -2070,6 +2060,16 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) set->queue_depth = BLK_MQ_MAX_DEPTH; } + /* + * If a crashdump is active, then we are potentially in a very + * memory constrained environment. Limit us to 1 queue and + * 64 tags to prevent using too much memory. + */ + if (is_kdump_kernel()) { + set->nr_hw_queues = 1; + set->queue_depth = min(64U, set->queue_depth); + } + set->tags = kmalloc_node(set->nr_hw_queues * sizeof(struct blk_mq_tags *), GFP_KERNEL, set->numa_node); |