diff options
author | Tejun Heo <tj@kernel.org> | 2025-04-09 09:06:00 -1000 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2025-04-09 09:06:00 -1000 |
commit | 743354e3bb7238552cda70a5f39ba6e946a899fd (patch) | |
tree | 3dc509045c34aef6f706b1fd559392fb112d18c8 /kernel/sched/ext.c | |
parent | 54d2e717bc5f419b111915adfdec7ecc1ca8cf90 (diff) |
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 <tj@kernel.org>
Acked-by: Changwoo Min <changwoo@igalia.com>
Acked-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'kernel/sched/ext.c')
-rw-r--r-- | kernel/sched/ext.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 1adf5c299cce..f0ed0cec4c98 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -928,8 +928,6 @@ DEFINE_STATIC_KEY_FALSE(__scx_switched_all); static struct sched_ext_ops scx_ops; static bool scx_warned_zero_slice; -DEFINE_STATIC_KEY_FALSE(scx_ops_allow_queued_wakeup); - static struct static_key_false scx_has_op[SCX_OPI_END] = { [0 ... SCX_OPI_END-1] = STATIC_KEY_FALSE_INIT }; @@ -4414,6 +4412,13 @@ bool task_should_scx(int policy) return policy == SCHED_EXT; } +bool scx_allow_ttwu_queue(const struct task_struct *p) +{ + return !scx_enabled() || + (scx_ops.flags & SCX_OPS_ALLOW_QUEUED_WAKEUP) || + p->sched_class != &ext_sched_class; +} + /** * scx_softlockup - sched_ext softlockup handler * @dur_s: number of seconds of CPU stuck due to soft lockup @@ -4728,7 +4733,6 @@ static void scx_disable_workfn(struct kthread_work *work) static_branch_disable(&__scx_enabled); for (i = SCX_OPI_BEGIN; i < SCX_OPI_END; i++) static_branch_disable(&scx_has_op[i]); - static_branch_disable(&scx_ops_allow_queued_wakeup); scx_idle_disable(); synchronize_rcu(); @@ -5367,8 +5371,6 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link) if (((void (**)(void))ops)[i]) static_branch_enable(&scx_has_op[i]); - if (ops->flags & SCX_OPS_ALLOW_QUEUED_WAKEUP) - static_branch_enable(&scx_ops_allow_queued_wakeup); if (scx_ops.cpu_acquire || scx_ops.cpu_release) scx_ops.flags |= SCX_OPS_HAS_CPU_PREEMPT; |