lkml.org 
[lkml]   [2018]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 10/24] sched/smt: Expose sched_smt_present static key
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 <tglx@linutronix.de>
---
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)

\
 
 \ /
  Last update: 2018-11-21 21:20    [W:0.341 / U:0.956 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site