From 743354e3bb7238552cda70a5f39ba6e946a899fd Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 9 Apr 2025 09:06:00 -1000 Subject: sched_ext: Remove scx_ops_allow_queued_wakeup static_key scx_ops_allow_queued_wakeup is used to encode SCX_OPS_ALLOW_QUEUED_WAKEUP into a static_key. The test is gated behind scx_enabled(), and, even when sched_ext is enabled, is unlikely for the static_key usage to make any meaningful difference. It is made to use a static_key mostly because there was no reason not to. However, global static_keys can't work with the planned hierarchical multiple scheduler support. Remove the static_key and instead test SCX_OPS_ALLOW_QUEUED_WAKEUP directly. In repeated hackbench runs before and after static_keys removal on an AMD Ryzen 3900X, I couldn't tell any measurable performance difference. Signed-off-by: Tejun Heo Acked-by: Changwoo Min Acked-by: Andrea Righi --- kernel/sched/ext.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'kernel/sched/ext.h') diff --git a/kernel/sched/ext.h b/kernel/sched/ext.h index 1bda96b19a1b..3053cdd61eb9 100644 --- a/kernel/sched/ext.h +++ b/kernel/sched/ext.h @@ -21,6 +21,7 @@ void scx_rq_activate(struct rq *rq); void scx_rq_deactivate(struct rq *rq); int scx_check_setscheduler(struct task_struct *p, int policy); bool task_should_scx(int policy); +bool scx_allow_ttwu_queue(const struct task_struct *p); void init_sched_ext_class(void); static inline u32 scx_cpuperf_target(s32 cpu) @@ -36,13 +37,6 @@ static inline bool task_on_scx(const struct task_struct *p) return scx_enabled() && p->sched_class == &ext_sched_class; } -static inline bool scx_allow_ttwu_queue(const struct task_struct *p) -{ - return !scx_enabled() || - static_branch_likely(&scx_ops_allow_queued_wakeup) || - p->sched_class != &ext_sched_class; -} - #ifdef CONFIG_SCHED_CORE bool scx_prio_less(const struct task_struct *a, const struct task_struct *b, bool in_fi); -- cgit v1.2.3 From 617a77018f683905ed4e8cd693df51243908353f Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Thu, 15 May 2025 21:11:42 +0200 Subject: sched_ext: Make scx_kf_allowed_if_unlocked() available outside ext.c Relocate the scx_kf_allowed_if_unlocked(), so it can be used from other source files (e.g., ext_idle.c). No functional change. Signed-off-by: Andrea Righi Signed-off-by: Tejun Heo --- kernel/sched/ext.c | 5 ----- kernel/sched/ext.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/sched/ext.h') diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 52e0f9553e73..793e288f63cf 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -1387,11 +1387,6 @@ static __always_inline bool scx_kf_allowed_on_arg_tasks(u32 mask, return true; } -static bool scx_kf_allowed_if_unlocked(void) -{ - return !current->scx.kf_mask; -} - /** * nldsq_next_task - Iterate to the next task in a non-local DSQ * @dsq: user dsq being iterated diff --git a/kernel/sched/ext.h b/kernel/sched/ext.h index 3053cdd61eb9..6e5072f57771 100644 --- a/kernel/sched/ext.h +++ b/kernel/sched/ext.h @@ -8,6 +8,11 @@ */ #ifdef CONFIG_SCHED_CLASS_EXT +static inline bool scx_kf_allowed_if_unlocked(void) +{ + return !current->scx.kf_mask; +} + DECLARE_STATIC_KEY_FALSE(scx_ops_allow_queued_wakeup); void scx_tick(struct rq *rq); -- cgit v1.2.3