forked from luck/tmp_suning_uos_patched
s390/cpuinfo: show number of online cores
Show number of cores that run at least one SMT thread Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
1a2ae03b19
commit
959684978d
|
@ -17,6 +17,7 @@ struct cpu_topology_s390 {
|
|||
unsigned short book_id;
|
||||
unsigned short drawer_id;
|
||||
unsigned short dedicated : 1;
|
||||
int booted_cores;
|
||||
cpumask_t thread_mask;
|
||||
cpumask_t core_mask;
|
||||
cpumask_t book_mask;
|
||||
|
@ -35,6 +36,7 @@ extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
|
|||
#define topology_drawer_id(cpu) (cpu_topology[cpu].drawer_id)
|
||||
#define topology_drawer_cpumask(cpu) (&cpu_topology[cpu].drawer_mask)
|
||||
#define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated)
|
||||
#define topology_booted_cores(cpu) (cpu_topology[cpu].booted_cores)
|
||||
|
||||
#define mc_capable() 1
|
||||
|
||||
|
@ -53,6 +55,7 @@ static inline void topology_init_early(void) { }
|
|||
static inline void topology_schedule_update(void) { }
|
||||
static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
|
||||
static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
|
||||
static inline int topology_booted_cores(int cpu_nr) { return 1; }
|
||||
static inline void update_cpu_masks(void) { }
|
||||
static inline void topology_expect_change(void) { }
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ static void show_cpu_topology(struct seq_file *m, unsigned long n)
|
|||
seq_printf(m, "drawer id : %d\n", topology_drawer_id(n));
|
||||
seq_printf(m, "dedicated : %d\n", topology_cpu_dedicated(n));
|
||||
seq_printf(m, "address : %d\n", smp_cpu_get_cpu_address(n));
|
||||
seq_printf(m, "cpu cores : %d\n", topology_booted_cores(n));
|
||||
#endif /* CONFIG_SCHED_TOPOLOGY */
|
||||
}
|
||||
|
||||
|
|
|
@ -245,8 +245,8 @@ int topology_set_cpu_management(int fc)
|
|||
|
||||
void update_cpu_masks(void)
|
||||
{
|
||||
struct cpu_topology_s390 *topo;
|
||||
int cpu, id;
|
||||
struct cpu_topology_s390 *topo, *topo_package, *topo_sibling;
|
||||
int cpu, sibling, pkg_first, smt_first, id;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
topo = &cpu_topology[cpu];
|
||||
|
@ -254,6 +254,7 @@ void update_cpu_masks(void)
|
|||
topo->core_mask = cpu_group_map(&socket_info, cpu);
|
||||
topo->book_mask = cpu_group_map(&book_info, cpu);
|
||||
topo->drawer_mask = cpu_group_map(&drawer_info, cpu);
|
||||
topo->booted_cores = 0;
|
||||
if (topology_mode != TOPOLOGY_MODE_HW) {
|
||||
id = topology_mode == TOPOLOGY_MODE_PACKAGE ? 0 : cpu;
|
||||
topo->thread_id = cpu;
|
||||
|
@ -263,6 +264,21 @@ void update_cpu_masks(void)
|
|||
topo->drawer_id = id;
|
||||
}
|
||||
}
|
||||
for_each_online_cpu(cpu) {
|
||||
topo = &cpu_topology[cpu];
|
||||
pkg_first = cpumask_first(&topo->core_mask);
|
||||
topo_package = &cpu_topology[pkg_first];
|
||||
if (cpu == pkg_first) {
|
||||
for_each_cpu(sibling, &topo->core_mask) {
|
||||
topo_sibling = &cpu_topology[sibling];
|
||||
smt_first = cpumask_first(&topo_sibling->thread_mask);
|
||||
if (sibling == smt_first)
|
||||
topo_package->booted_cores++;
|
||||
}
|
||||
} else {
|
||||
topo->booted_cores = topo_package->booted_cores;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void store_topology(struct sysinfo_15_1_x *info)
|
||||
|
|
Loading…
Reference in New Issue
Block a user