From 783899aabff9c40d4a901d74908826fc3cde45a4 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wang Date: Thu, 25 Jun 2020 13:31:37 +0800 Subject: [PATCH] Revert "blk-mq: balance mapping between present CPUs and queues" to #28991349 This reverts commit a3d72a0c79fac0e113bbeb85e1e19b3b3568e2f5. Previously we just backported this patch partly, now we revert it temporarily and will backport it in later patches formally. Signed-off-by: Xiaoguang Wang Reviewed-by: Joseph Qi --- block/blk-mq-cpumap.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 7581901da3fd..3eb169f15842 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -14,9 +14,9 @@ #include "blk.h" #include "blk-mq.h" -static int queue_index(unsigned int nr_queues, const int q) +static int cpu_to_queue_index(unsigned int nr_queues, const int cpu) { - return q % nr_queues; + return cpu % nr_queues; } static int get_first_sibling(unsigned int cpu) @@ -34,24 +34,9 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set) { unsigned int *map = set->mq_map; unsigned int nr_queues = set->nr_hw_queues; - unsigned int cpu, first_sibling, q = 0; - - for_each_possible_cpu(cpu) - map[cpu] = -1; - - /* - * Spread queues among present CPUs first for minimizing - * count of dead queues which are mapped by all un-present CPUs - */ - for_each_present_cpu(cpu) { - if (q >= nr_queues) - break; - map[cpu] = queue_index(nr_queues, q++); - } + unsigned int cpu, first_sibling; for_each_possible_cpu(cpu) { - if (map[cpu] != -1) - continue; /* * First do sequential mapping between CPUs and queues. * In case we still have CPUs to map, and we have some number of @@ -59,11 +44,11 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set) * performace optimizations. */ if (cpu < nr_queues) { - map[cpu] = queue_index(nr_queues, q++); + map[cpu] = cpu_to_queue_index(nr_queues, cpu); } else { first_sibling = get_first_sibling(cpu); if (first_sibling == cpu) - map[cpu] = queue_index(nr_queues, q++); + map[cpu] = cpu_to_queue_index(nr_queues, cpu); else map[cpu] = map[first_sibling]; } -- GitLab