提交 439eb131 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

s390/topology: reduce per_cpu() invocations

Each per_cpu() invocation generates extra code. Since there are a lot
of similiar calls in the topology code we can avoid a lot of them.
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 36324963
...@@ -84,6 +84,7 @@ static struct mask_info *add_cpus_to_mask(struct topology_core *tl_core, ...@@ -84,6 +84,7 @@ static struct mask_info *add_cpus_to_mask(struct topology_core *tl_core,
struct mask_info *socket, struct mask_info *socket,
int one_socket_per_cpu) int one_socket_per_cpu)
{ {
struct cpu_topology_s390 *topo;
unsigned int core; unsigned int core;
for_each_set_bit(core, &tl_core->mask[0], TOPOLOGY_CORE_BITS) { for_each_set_bit(core, &tl_core->mask[0], TOPOLOGY_CORE_BITS) {
...@@ -95,15 +96,16 @@ static struct mask_info *add_cpus_to_mask(struct topology_core *tl_core, ...@@ -95,15 +96,16 @@ static struct mask_info *add_cpus_to_mask(struct topology_core *tl_core,
if (lcpu < 0) if (lcpu < 0)
continue; continue;
for (i = 0; i <= smp_cpu_mtid; i++) { for (i = 0; i <= smp_cpu_mtid; i++) {
per_cpu(cpu_topology, lcpu + i).book_id = book->id; topo = &per_cpu(cpu_topology, lcpu + i);
per_cpu(cpu_topology, lcpu + i).core_id = rcore; topo->book_id = book->id;
per_cpu(cpu_topology, lcpu + i).thread_id = lcpu + i; topo->core_id = rcore;
topo->thread_id = lcpu + i;
cpumask_set_cpu(lcpu + i, &book->mask); cpumask_set_cpu(lcpu + i, &book->mask);
cpumask_set_cpu(lcpu + i, &socket->mask); cpumask_set_cpu(lcpu + i, &socket->mask);
if (one_socket_per_cpu) if (one_socket_per_cpu)
per_cpu(cpu_topology, lcpu + i).socket_id = rcore; topo->socket_id = rcore;
else else
per_cpu(cpu_topology, lcpu + i).socket_id = socket->id; topo->socket_id = socket->id;
smp_cpu_set_polarization(lcpu + i, tl_core->pp); smp_cpu_set_polarization(lcpu + i, tl_core->pp);
} }
if (one_socket_per_cpu) if (one_socket_per_cpu)
...@@ -247,17 +249,19 @@ int topology_set_cpu_management(int fc) ...@@ -247,17 +249,19 @@ int topology_set_cpu_management(int fc)
static void update_cpu_masks(void) static void update_cpu_masks(void)
{ {
struct cpu_topology_s390 *topo;
int cpu; int cpu;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
per_cpu(cpu_topology, cpu).thread_mask = cpu_thread_map(cpu); topo = &per_cpu(cpu_topology, cpu);
per_cpu(cpu_topology, cpu).core_mask = cpu_group_map(&socket_info, cpu); topo->thread_mask = cpu_thread_map(cpu);
per_cpu(cpu_topology, cpu).book_mask = cpu_group_map(&book_info, cpu); topo->core_mask = cpu_group_map(&socket_info, cpu);
topo->book_mask = cpu_group_map(&book_info, cpu);
if (!MACHINE_HAS_TOPOLOGY) { if (!MACHINE_HAS_TOPOLOGY) {
per_cpu(cpu_topology, cpu).thread_id = cpu; topo->thread_id = cpu;
per_cpu(cpu_topology, cpu).core_id = cpu; topo->core_id = cpu;
per_cpu(cpu_topology, cpu).socket_id = cpu; topo->socket_id = cpu;
per_cpu(cpu_topology, cpu).book_id = cpu; topo->book_id = cpu;
} }
} }
numa_update_cpu_topology(); numa_update_cpu_topology();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册