Make the scheduler's 'sched_smt_present' static key globaly available, so it can be used in the x86 speculation control code. Provide a query function and a stub for the CONFIG_SMP=n case. Signed-off-by: Thomas Gleixner --- include/linux/sched/topology.h | 9 +++++++++ kernel/sched/sched.h | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -34,10 +34,19 @@ #define SD_NUMA 0x4000 /* cross-node balancing */ #ifdef CONFIG_SCHED_SMT +extern struct static_key_false sched_smt_present; + +static __always_inline bool sched_smt_active(void) +{ + return static_branch_likely(&sched_smt_present); +} + static inline int cpu_smt_flags(void) { return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; } +#else +static inline bool sched_smt_active(void) { return false; } #endif #ifdef CONFIG_SCHED_MC --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -941,9 +941,6 @@ static inline int cpu_of(struct rq *rq) #ifdef CONFIG_SCHED_SMT - -extern struct static_key_false sched_smt_present; - extern void __update_idle_core(struct rq *rq); static inline void update_idle_core(struct rq *rq)