Commit 0e797117 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Greg Kroah-Hartman

sched/smt: Expose sched_smt_present static key

commit 321a874a upstream

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: default avatarThomas Gleixner <>
Reviewed-by: default avatarIngo Molnar <>
Cc: Peter Zijlstra <>
Cc: Andy Lutomirski <>
Cc: Linus Torvalds <>
Cc: Jiri Kosina <>
Cc: Tom Lendacky <>
Cc: Josh Poimboeuf <>
Cc: Andrea Arcangeli <>
Cc: David Woodhouse <>
Cc: Tim Chen <>
Cc: Andi Kleen <>
Cc: Dave Hansen <>
Cc: Casey Schaufler <>
Cc: Asit Mallick <>
Cc: Arjan van de Ven <>
Cc: Jon Masters <>
Cc: Waiman Long <>
Cc: Greg KH <>
Cc: Dave Stewart <>
Cc: Kees Cook <>
Link: default avatarGreg Kroah-Hartman <>
parent 44ac7cd0
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/static_key.h>
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 bool sched_smt_active(void) { return false; }
......@@ -20,6 +20,7 @@
#include <linux/sched/task_stack.h>
#include <linux/sched/cputime.h>
#include <linux/sched/init.h>
#include <linux/sched/smt.h>
#include <linux/u64_stats_sync.h>
#include <linux/kernel_stat.h>
......@@ -825,9 +826,6 @@ static inline int cpu_of(struct rq *rq)
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)
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