The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: torvalds@linux-foundation.org
Cc: void@manifault.com, mingo@redhat.com, peterz@infradead.org,
	tglx@linutronix.de, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH 1/3] sched_ext: Minor cleanups in kernel/sched/ext.h
Date: Sat, 22 Jun 2024 15:50:20 -1000	[thread overview]
Message-ID: <20240623015057.3383223-2-tj@kernel.org> (raw)
In-Reply-To: <20240623015057.3383223-1-tj@kernel.org>

- scx_ops_cpu_preempt is only used in kernel/sched/ext.c and doesn't need to
  be global. Make it static.

- Relocate task_on_scx() so that the inline functions are located together.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>
---
 kernel/sched/ext.c |  2 +-
 kernel/sched/ext.h | 12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 28f7a4266fde..d4c645f9e031 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -771,7 +771,7 @@ static bool scx_warned_zero_slice;
 
 static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_last);
 static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_exiting);
-DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
+static DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
 static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);
 
 struct static_key_false scx_has_op[SCX_OPI_END] =
diff --git a/kernel/sched/ext.h b/kernel/sched/ext.h
index 0a7b9a34b18f..229007693504 100644
--- a/kernel/sched/ext.h
+++ b/kernel/sched/ext.h
@@ -26,13 +26,6 @@ DECLARE_STATIC_KEY_FALSE(__scx_switched_all);
 #define scx_enabled()		static_branch_unlikely(&__scx_ops_enabled)
 #define scx_switched_all()	static_branch_unlikely(&__scx_switched_all)
 
-DECLARE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
-
-static inline bool task_on_scx(const struct task_struct *p)
-{
-	return scx_enabled() && p->sched_class == &ext_sched_class;
-}
-
 void scx_tick(struct rq *rq);
 void init_scx_entity(struct sched_ext_entity *scx);
 void scx_pre_fork(struct task_struct *p);
@@ -54,6 +47,11 @@ static inline u32 scx_cpuperf_target(s32 cpu)
 		return 0;
 }
 
+static inline bool task_on_scx(const struct task_struct *p)
+{
+	return scx_enabled() && p->sched_class == &ext_sched_class;
+}
+
 static inline const struct sched_class *next_active_class(const struct sched_class *class)
 {
 	class++;
-- 
2.45.2


  reply	other threads:[~2024-06-23  1:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23  1:50 [PATCHSET sched_ext/for-6.11] sched_ext: Clean up kernel/sched/ext.h Tejun Heo
2024-06-23  1:50 ` Tejun Heo [this message]
2024-06-23  7:16   ` [PATCH 1/3] sched_ext: Minor cleanups in kernel/sched/ext.h David Vernet
2024-06-23  1:50 ` [PATCH 2/3] sched, sched_ext: Open code for_balance_class_range() Tejun Heo
2024-06-23  7:17   ` David Vernet
2024-06-23  1:50 ` [PATCH 3/3] sched, sched_ext: Move some declarations from kernel/sched/ext.h to sched.h Tejun Heo
2024-06-23  7:48   ` David Vernet
2024-07-08 19:39 ` [PATCHSET sched_ext/for-6.11] sched_ext: Clean up kernel/sched/ext.h Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240623015057.3383223-2-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox