Commit f6bf1a8a authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] topology: fix topology on z10 machines

Make sure that all cpus in a book on a z10 appear as book siblings
and not as core siblings. This fixes some performance regressions that
appeared after the book scheduling domain got introduced.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 6ed54387
...@@ -68,8 +68,10 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) ...@@ -68,8 +68,10 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
return mask; return mask;
} }
static void add_cpus_to_mask(struct topology_cpu *tl_cpu, static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
struct mask_info *book, struct mask_info *core) struct mask_info *book,
struct mask_info *core,
int z10)
{ {
unsigned int cpu; unsigned int cpu;
...@@ -88,10 +90,16 @@ static void add_cpus_to_mask(struct topology_cpu *tl_cpu, ...@@ -88,10 +90,16 @@ static void add_cpus_to_mask(struct topology_cpu *tl_cpu,
cpu_book_id[lcpu] = book->id; cpu_book_id[lcpu] = book->id;
#endif #endif
cpumask_set_cpu(lcpu, &core->mask); cpumask_set_cpu(lcpu, &core->mask);
cpu_core_id[lcpu] = core->id; if (z10) {
cpu_core_id[lcpu] = rcpu;
core = core->next;
} else {
cpu_core_id[lcpu] = core->id;
}
smp_cpu_polarization[lcpu] = tl_cpu->pp; smp_cpu_polarization[lcpu] = tl_cpu->pp;
} }
} }
return core;
} }
static void clear_masks(void) static void clear_masks(void)
...@@ -123,18 +131,41 @@ static void tl_to_cores(struct sysinfo_15_1_x *info) ...@@ -123,18 +131,41 @@ static void tl_to_cores(struct sysinfo_15_1_x *info)
{ {
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
struct mask_info *book = &book_info; struct mask_info *book = &book_info;
struct cpuid cpu_id;
#else #else
struct mask_info *book = NULL; struct mask_info *book = NULL;
#endif #endif
struct mask_info *core = &core_info; struct mask_info *core = &core_info;
union topology_entry *tle, *end; union topology_entry *tle, *end;
int z10 = 0;
#ifdef CONFIG_SCHED_BOOK
get_cpu_id(&cpu_id);
z10 = cpu_id.machine == 0x2097 || cpu_id.machine == 0x2098;
#endif
spin_lock_irq(&topology_lock); spin_lock_irq(&topology_lock);
clear_masks(); clear_masks();
tle = info->tle; tle = info->tle;
end = (union topology_entry *)((unsigned long)info + info->length); end = (union topology_entry *)((unsigned long)info + info->length);
while (tle < end) { while (tle < end) {
#ifdef CONFIG_SCHED_BOOK
if (z10) {
switch (tle->nl) {
case 1:
book = book->next;
book->id = tle->container.id;
break;
case 0:
core = add_cpus_to_mask(&tle->cpu, book, core, z10);
break;
default:
clear_masks();
goto out;
}
tle = next_tle(tle);
continue;
}
#endif
switch (tle->nl) { switch (tle->nl) {
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
case 2: case 2:
...@@ -147,7 +178,7 @@ static void tl_to_cores(struct sysinfo_15_1_x *info) ...@@ -147,7 +178,7 @@ static void tl_to_cores(struct sysinfo_15_1_x *info)
core->id = tle->container.id; core->id = tle->container.id;
break; break;
case 0: case 0:
add_cpus_to_mask(&tle->cpu, book, core); add_cpus_to_mask(&tle->cpu, book, core, z10);
break; break;
default: default:
clear_masks(); clear_masks();
...@@ -328,8 +359,8 @@ void __init s390_init_cpu_topology(void) ...@@ -328,8 +359,8 @@ void __init s390_init_cpu_topology(void)
for (i = 0; i < TOPOLOGY_NR_MAG; i++) for (i = 0; i < TOPOLOGY_NR_MAG; i++)
printk(" %d", info->mag[i]); printk(" %d", info->mag[i]);
printk(" / %d\n", info->mnest); printk(" / %d\n", info->mnest);
alloc_masks(info, &core_info, 2); alloc_masks(info, &core_info, 1);
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
alloc_masks(info, &book_info, 3); alloc_masks(info, &book_info, 2);
#endif #endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment