aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-07-06 08:20:14 -0400
committerIngo Molnar <mingo@elte.hu>2011-12-06 14:51:26 -0500
commitf8b6d1cc7dc15cf3de538b864eefaedad7a84d85 (patch)
tree084948d4bebc74a66231d95e03daaeb808640d66 /kernel/sched/sched.h
parentbe726ffd1ef291c04c4d6632ac277afa1c281712 (diff)
sched: Use jump_labels for sched_feat
Now that we initialize jump_labels before sched_init() we can use them for the debug features without having to worry about a window where they have the wrong setting. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-vpreo4hal9e0kzqmg5y0io2k@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c24801636219..d8d3613a4055 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -581,6 +581,7 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
581 * Tunables that become constants when CONFIG_SCHED_DEBUG is off: 581 * Tunables that become constants when CONFIG_SCHED_DEBUG is off:
582 */ 582 */
583#ifdef CONFIG_SCHED_DEBUG 583#ifdef CONFIG_SCHED_DEBUG
584# include <linux/jump_label.h>
584# define const_debug __read_mostly 585# define const_debug __read_mostly
585#else 586#else
586# define const_debug const 587# define const_debug const
@@ -593,11 +594,37 @@ extern const_debug unsigned int sysctl_sched_features;
593 594
594enum { 595enum {
595#include "features.h" 596#include "features.h"
597 __SCHED_FEAT_NR,
596}; 598};
597 599
598#undef SCHED_FEAT 600#undef SCHED_FEAT
599 601
602#if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL)
603static __always_inline bool static_branch__true(struct jump_label_key *key)
604{
605 return likely(static_branch(key)); /* Not out of line branch. */
606}
607
608static __always_inline bool static_branch__false(struct jump_label_key *key)
609{
610 return unlikely(static_branch(key)); /* Out of line branch. */
611}
612
613#define SCHED_FEAT(name, enabled) \
614static __always_inline bool static_branch_##name(struct jump_label_key *key) \
615{ \
616 return static_branch__##enabled(key); \
617}
618
619#include "features.h"
620
621#undef SCHED_FEAT
622
623extern struct jump_label_key sched_feat_keys[__SCHED_FEAT_NR];
624#define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x]))
625#else /* !(SCHED_DEBUG && HAVE_JUMP_LABEL) */
600#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) 626#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
627#endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */
601 628
602static inline u64 global_rt_period(void) 629static inline u64 global_rt_period(void)
603{ 630{