Skip to content

Commit 91b4a7d

Browse files
ldu4KAGA-KOKO
authored andcommitted
cpu/SMT: Remove topology_smt_supported()
Since the maximum number of threads is now passed to cpu_smt_set_num_threads(), checking that value is enough to know whether SMT is supported. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Zhang Rui <rui.zhang@intel.com> Link: https://lore.kernel.org/r/20230705145143.40545-6-ldufour@linux.ibm.com
1 parent 447ae4a commit 91b4a7d

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

arch/x86/include/asm/topology.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ static inline int topology_max_smt_threads(void)
141141
int topology_update_package_map(unsigned int apicid, unsigned int cpu);
142142
int topology_update_die_map(unsigned int dieid, unsigned int cpu);
143143
int topology_phys_to_logical_pkg(unsigned int pkg);
144-
bool topology_smt_supported(void);
145144

146145
extern struct cpumask __cpu_primary_thread_mask;
147146
#define cpu_primary_thread_mask ((const struct cpumask *)&__cpu_primary_thread_mask)
@@ -164,7 +163,6 @@ static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
164163
static inline int topology_max_die_per_package(void) { return 1; }
165164
static inline int topology_max_smt_threads(void) { return 1; }
166165
static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
167-
static inline bool topology_smt_supported(void) { return false; }
168166
#endif /* !CONFIG_SMP */
169167

170168
static inline void arch_fix_phys_package_id(int num, u32 slot)

arch/x86/kernel/smpboot.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,6 @@ static void notrace start_secondary(void *unused)
326326
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
327327
}
328328

329-
/**
330-
* topology_smt_supported - Check whether SMT is supported by the CPUs
331-
*/
332-
bool topology_smt_supported(void)
333-
{
334-
return smp_num_siblings > 1;
335-
}
336-
337329
/**
338330
* topology_phys_to_logical_pkg - Map a physical package id to a logical
339331
* @phys_pkg: The physical package id to map

kernel/cpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ void __init cpu_smt_set_num_threads(unsigned int num_threads,
621621
{
622622
WARN_ON(!num_threads || (num_threads > max_threads));
623623

624-
if (!topology_smt_supported())
624+
if (max_threads == 1)
625625
cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
626626

627627
cpu_smt_max_threads = max_threads;
@@ -1801,7 +1801,7 @@ early_param("cpuhp.parallel", parallel_bringup_parse_param);
18011801

18021802
static inline bool cpuhp_smt_aware(void)
18031803
{
1804-
return topology_smt_supported();
1804+
return cpu_smt_max_threads > 1;
18051805
}
18061806

18071807
static inline const struct cpumask *cpuhp_get_primary_thread_mask(void)

0 commit comments

Comments
 (0)