Skip to content

Commit ea9b262

Browse files
Changwoo Minhtejun
authored andcommitted
sched_ext: Relocate scx_enabled() related code
scx_enabled() will be used in scx_rq_clock_update/invalidate() in the following patch, so relocate the scx_enabled() related code to the proper location. Signed-off-by: Changwoo Min <changwoo@igalia.com> Acked-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent a73bca3 commit ea9b262

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

kernel/sched/sched.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,19 @@ struct rq_flags {
17171717

17181718
extern struct balance_callback balance_push_callback;
17191719

1720+
#ifdef CONFIG_SCHED_CLASS_EXT
1721+
extern const struct sched_class ext_sched_class;
1722+
1723+
DECLARE_STATIC_KEY_FALSE(__scx_ops_enabled); /* SCX BPF scheduler loaded */
1724+
DECLARE_STATIC_KEY_FALSE(__scx_switched_all); /* all fair class tasks on SCX */
1725+
1726+
#define scx_enabled() static_branch_unlikely(&__scx_ops_enabled)
1727+
#define scx_switched_all() static_branch_unlikely(&__scx_switched_all)
1728+
#else /* !CONFIG_SCHED_CLASS_EXT */
1729+
#define scx_enabled() false
1730+
#define scx_switched_all() false
1731+
#endif /* !CONFIG_SCHED_CLASS_EXT */
1732+
17201733
/*
17211734
* Lockdep annotation that avoids accidental unlocks; it's like a
17221735
* sticky/continuous lockdep_assert_held().
@@ -2505,19 +2518,6 @@ extern const struct sched_class rt_sched_class;
25052518
extern const struct sched_class fair_sched_class;
25062519
extern const struct sched_class idle_sched_class;
25072520

2508-
#ifdef CONFIG_SCHED_CLASS_EXT
2509-
extern const struct sched_class ext_sched_class;
2510-
2511-
DECLARE_STATIC_KEY_FALSE(__scx_ops_enabled); /* SCX BPF scheduler loaded */
2512-
DECLARE_STATIC_KEY_FALSE(__scx_switched_all); /* all fair class tasks on SCX */
2513-
2514-
#define scx_enabled() static_branch_unlikely(&__scx_ops_enabled)
2515-
#define scx_switched_all() static_branch_unlikely(&__scx_switched_all)
2516-
#else /* !CONFIG_SCHED_CLASS_EXT */
2517-
#define scx_enabled() false
2518-
#define scx_switched_all() false
2519-
#endif /* !CONFIG_SCHED_CLASS_EXT */
2520-
25212521
/*
25222522
* Iterate only active classes. SCX can take over all fair tasks or be
25232523
* completely disabled. If the former, skip fair. If the latter, skip SCX.

0 commit comments

Comments
 (0)