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>
This commit is contained in:

committed by
Ingo Molnar

parent
be726ffd1e
commit
f8b6d1cc7d
@@ -581,6 +581,7 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
|
||||
* Tunables that become constants when CONFIG_SCHED_DEBUG is off:
|
||||
*/
|
||||
#ifdef CONFIG_SCHED_DEBUG
|
||||
# include <linux/jump_label.h>
|
||||
# define const_debug __read_mostly
|
||||
#else
|
||||
# define const_debug const
|
||||
@@ -593,11 +594,37 @@ extern const_debug unsigned int sysctl_sched_features;
|
||||
|
||||
enum {
|
||||
#include "features.h"
|
||||
__SCHED_FEAT_NR,
|
||||
};
|
||||
|
||||
#undef SCHED_FEAT
|
||||
|
||||
#if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL)
|
||||
static __always_inline bool static_branch__true(struct jump_label_key *key)
|
||||
{
|
||||
return likely(static_branch(key)); /* Not out of line branch. */
|
||||
}
|
||||
|
||||
static __always_inline bool static_branch__false(struct jump_label_key *key)
|
||||
{
|
||||
return unlikely(static_branch(key)); /* Out of line branch. */
|
||||
}
|
||||
|
||||
#define SCHED_FEAT(name, enabled) \
|
||||
static __always_inline bool static_branch_##name(struct jump_label_key *key) \
|
||||
{ \
|
||||
return static_branch__##enabled(key); \
|
||||
}
|
||||
|
||||
#include "features.h"
|
||||
|
||||
#undef SCHED_FEAT
|
||||
|
||||
extern struct jump_label_key sched_feat_keys[__SCHED_FEAT_NR];
|
||||
#define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x]))
|
||||
#else /* !(SCHED_DEBUG && HAVE_JUMP_LABEL) */
|
||||
#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
|
||||
#endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */
|
||||
|
||||
static inline u64 global_rt_period(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user