]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Relocate scx_enabled() related code
authorChangwoo Min <changwoo@igalia.com>
Thu, 9 Jan 2025 13:14:51 +0000 (22:14 +0900)
committerTejun Heo <tj@kernel.org>
Fri, 10 Jan 2025 18:04:40 +0000 (08:04 -1000)
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>
kernel/sched/sched.h

index 76f5f53a645fcdc3de25c224813c7ac3b6aefa1a..440ecedf871b0a69cd92d6c835c128377607911c 100644 (file)
@@ -1717,6 +1717,19 @@ struct rq_flags {
 
 extern struct balance_callback balance_push_callback;
 
+#ifdef CONFIG_SCHED_CLASS_EXT
+extern const struct sched_class ext_sched_class;
+
+DECLARE_STATIC_KEY_FALSE(__scx_ops_enabled);   /* SCX BPF scheduler loaded */
+DECLARE_STATIC_KEY_FALSE(__scx_switched_all);  /* all fair class tasks on SCX */
+
+#define scx_enabled()          static_branch_unlikely(&__scx_ops_enabled)
+#define scx_switched_all()     static_branch_unlikely(&__scx_switched_all)
+#else /* !CONFIG_SCHED_CLASS_EXT */
+#define scx_enabled()          false
+#define scx_switched_all()     false
+#endif /* !CONFIG_SCHED_CLASS_EXT */
+
 /*
  * Lockdep annotation that avoids accidental unlocks; it's like a
  * sticky/continuous lockdep_assert_held().
@@ -2505,19 +2518,6 @@ extern const struct sched_class rt_sched_class;
 extern const struct sched_class fair_sched_class;
 extern const struct sched_class idle_sched_class;
 
-#ifdef CONFIG_SCHED_CLASS_EXT
-extern const struct sched_class ext_sched_class;
-
-DECLARE_STATIC_KEY_FALSE(__scx_ops_enabled);   /* SCX BPF scheduler loaded */
-DECLARE_STATIC_KEY_FALSE(__scx_switched_all);  /* all fair class tasks on SCX */
-
-#define scx_enabled()          static_branch_unlikely(&__scx_ops_enabled)
-#define scx_switched_all()     static_branch_unlikely(&__scx_switched_all)
-#else /* !CONFIG_SCHED_CLASS_EXT */
-#define scx_enabled()          false
-#define scx_switched_all()     false
-#endif /* !CONFIG_SCHED_CLASS_EXT */
-
 /*
  * Iterate only active classes. SCX can take over all fair tasks or be
  * completely disabled. If the former, skip fair. If the latter, skip SCX.