提交 783899aa 编写于 作者: X Xiaoguang Wang 提交者: Caspar Zhang

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: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 fe15220e
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include "blk.h" #include "blk.h"
#include "blk-mq.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) static int get_first_sibling(unsigned int cpu)
...@@ -34,24 +34,9 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set) ...@@ -34,24 +34,9 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)
{ {
unsigned int *map = set->mq_map; unsigned int *map = set->mq_map;
unsigned int nr_queues = set->nr_hw_queues; unsigned int nr_queues = set->nr_hw_queues;
unsigned int cpu, first_sibling, q = 0; unsigned int cpu, first_sibling;
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++);
}
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
if (map[cpu] != -1)
continue;
/* /*
* First do sequential mapping between CPUs and queues. * First do sequential mapping between CPUs and queues.
* In case we still have CPUs to map, and we have some number of * 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) ...@@ -59,11 +44,11 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)
* performace optimizations. * performace optimizations.
*/ */
if (cpu < nr_queues) { if (cpu < nr_queues) {
map[cpu] = queue_index(nr_queues, q++); map[cpu] = cpu_to_queue_index(nr_queues, cpu);
} else { } else {
first_sibling = get_first_sibling(cpu); first_sibling = get_first_sibling(cpu);
if (first_sibling == cpu) if (first_sibling == cpu)
map[cpu] = queue_index(nr_queues, q++); map[cpu] = cpu_to_queue_index(nr_queues, cpu);
else else
map[cpu] = map[first_sibling]; map[cpu] = map[first_sibling];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册