Skip to content

Commit 8078f4d

Browse files
committed
x86/cpu/topology: Rename smp_num_siblings
It's really a non-intuitive name. Rename it to __max_threads_per_core which is obvious. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Kelley <mhklinux@outlook.com> Tested-by: Sohil Mehta <sohil.mehta@intel.com> Link: https://lore.kernel.org/r/20240213210253.011307973@linutronix.de
1 parent 3205c98 commit 8078f4d

File tree

9 files changed

+13
-14
lines changed

9 files changed

+13
-14
lines changed

arch/x86/include/asm/perf_event_p4.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ static inline u64 p4_clear_ht_bit(u64 config)
181181
static inline int p4_ht_active(void)
182182
{
183183
#ifdef CONFIG_SMP
184-
return smp_num_siblings > 1;
184+
return __max_threads_per_core > 1;
185185
#endif
186186
return 0;
187187
}
188188

189189
static inline int p4_ht_thread(int cpu)
190190
{
191191
#ifdef CONFIG_SMP
192-
if (smp_num_siblings == 2)
192+
if (__max_threads_per_core == 2)
193193
return cpu != cpumask_first(this_cpu_cpumask_var_ptr(cpu_sibling_map));
194194
#endif
195195
return 0;

arch/x86/include/asm/smp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include <asm/current.h>
99
#include <asm/thread_info.h>
1010

11-
extern unsigned int smp_num_siblings;
12-
1311
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
1412
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
1513
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_die_map);

arch/x86/include/asm/topology.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
145145

146146
extern unsigned int __max_dies_per_package;
147147
extern unsigned int __max_logical_packages;
148+
extern unsigned int __max_threads_per_core;
148149

149150
static inline unsigned int topology_max_packages(void)
150151
{

arch/x86/kernel/cpu/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
u32 elf_hwcap2 __read_mostly;
7474

7575
/* Number of siblings per CPU package */
76-
unsigned int smp_num_siblings __ro_after_init = 1;
77-
EXPORT_SYMBOL(smp_num_siblings);
76+
unsigned int __max_threads_per_core __ro_after_init = 1;
77+
EXPORT_SYMBOL(__max_threads_per_core);
7878

7979
unsigned int __max_dies_per_package __ro_after_init = 1;
8080
EXPORT_SYMBOL(__max_dies_per_package);
@@ -2251,7 +2251,7 @@ void __init arch_cpu_finalize_init(void)
22512251
* identify_boot_cpu() initialized SMT support information, let the
22522252
* core code know.
22532253
*/
2254-
cpu_smt_set_num_threads(smp_num_siblings, smp_num_siblings);
2254+
cpu_smt_set_num_threads(__max_threads_per_core, __max_threads_per_core);
22552255

22562256
if (!IS_ENABLED(CONFIG_SMP)) {
22572257
pr_info("CPU: ");

arch/x86/kernel/cpu/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int cpu_debug_show(struct seq_file *m, void *p)
3030
seq_printf(m, "amd_nodes_per_pkg: %u\n", topology_amd_nodes_per_pkg());
3131
seq_printf(m, "max_cores: %u\n", c->x86_max_cores);
3232
seq_printf(m, "max_dies_per_pkg: %u\n", __max_dies_per_package);
33-
seq_printf(m, "smp_num_siblings: %u\n", smp_num_siblings);
33+
seq_printf(m, "max_threads_per_core:%u\n", __max_threads_per_core);
3434
return 0;
3535
}
3636

arch/x86/kernel/cpu/mce/inject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static u32 get_nbc_for_node(int node_id)
433433
struct cpuinfo_x86 *c = &boot_cpu_data;
434434
u32 cores_per_node;
435435

436-
cores_per_node = (c->x86_max_cores * smp_num_siblings) / topology_amd_nodes_per_pkg();
436+
cores_per_node = (c->x86_max_cores * __max_threads_per_core) / topology_amd_nodes_per_pkg();
437437
return cores_per_node * node_id;
438438
}
439439

arch/x86/kernel/cpu/topology.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
7676
#ifdef CONFIG_SMP
7777
static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid)
7878
{
79-
if (!(apicid & (smp_num_siblings - 1)))
79+
if (!(apicid & (__max_threads_per_core - 1)))
8080
cpumask_set_cpu(cpu, &__cpu_primary_thread_mask);
8181
}
8282
#else
@@ -429,8 +429,8 @@ void __init topology_init_possible_cpus(void)
429429
* Can't use order delta here as order(cnta) can be equal
430430
* order(cntb) even if cnta != cntb.
431431
*/
432-
smp_num_siblings = DIV_ROUND_UP(cntb, cnta);
433-
pr_info("Max. threads per core: %3u\n", smp_num_siblings);
432+
__max_threads_per_core = DIV_ROUND_UP(cntb, cnta);
433+
pr_info("Max. threads per core: %3u\n", __max_threads_per_core);
434434

435435
pr_info("Allowing %u present CPUs plus %u hotplug CPUs\n", assigned, disabled);
436436
if (topo_info.nr_rejected_cpus)

arch/x86/kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ static __cpuidle void mwait_idle(void)
936936
void select_idle_routine(const struct cpuinfo_x86 *c)
937937
{
938938
#ifdef CONFIG_SMP
939-
if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1)
939+
if (boot_option_idle_override == IDLE_POLL && __max_threads_per_core > 1)
940940
pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n");
941941
#endif
942942
if (x86_idle_set() || boot_option_idle_override == IDLE_POLL)

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static void __init build_sched_topology(void)
563563

564564
void set_cpu_sibling_map(int cpu)
565565
{
566-
bool has_smt = smp_num_siblings > 1;
566+
bool has_smt = __max_threads_per_core > 1;
567567
bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1;
568568
struct cpuinfo_x86 *c = &cpu_data(cpu);
569569
struct cpuinfo_x86 *o;

0 commit comments

Comments
 (0)