]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
blk-mq: use 'nr_cpu_ids' as highest CPU ID count for hwq <-> cpu map
authorJens Axboe <axboe@fb.com>
Mon, 24 Nov 2014 22:02:42 +0000 (15:02 -0700)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 12 Jan 2015 15:43:57 +0000 (15:43 +0000)
commit a33c1ba2913802b6fb23e974bb2f6a4e73c8b7ce upstream.

We currently use num_possible_cpus(), but that breaks on sparc64 where
the CPU ID space is discontig. Use nr_cpu_ids as the highest CPU ID
instead, so we don't end up reading from invalid memory.

Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
block/blk-mq-cpumap.c

index 1065d7c65fa15b60b1104944322533033df69df7..72e5ed691e37ae38eadf606bf0d017308c3e48bc 100644 (file)
@@ -90,7 +90,7 @@ unsigned int *blk_mq_make_queue_map(struct blk_mq_tag_set *set)
        unsigned int *map;
 
        /* If cpus are offline, map them to first hctx */
-       map = kzalloc_node(sizeof(*map) * num_possible_cpus(), GFP_KERNEL,
+       map = kzalloc_node(sizeof(*map) * nr_cpu_ids, GFP_KERNEL,
                                set->numa_node);
        if (!map)
                return NULL;