Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+8 -12
+7 -5
kernel/sched/ext.c
··· 928 928 static struct sched_ext_ops scx_ops; 929 929 static bool scx_warned_zero_slice; 930 930 931 - DEFINE_STATIC_KEY_FALSE(scx_ops_allow_queued_wakeup); 932 - 933 931 static struct static_key_false scx_has_op[SCX_OPI_END] = 934 932 { [0 ... SCX_OPI_END-1] = STATIC_KEY_FALSE_INIT }; 935 933 ··· 4412 4414 return policy == SCHED_EXT; 4413 4415 } 4414 4416 4417 + bool scx_allow_ttwu_queue(const struct task_struct *p) 4418 + { 4419 + return !scx_enabled() || 4420 + (scx_ops.flags & SCX_OPS_ALLOW_QUEUED_WAKEUP) || 4421 + p->sched_class != &ext_sched_class; 4422 + } 4423 + 4415 4424 /** 4416 4425 * scx_softlockup - sched_ext softlockup handler 4417 4426 * @dur_s: number of seconds of CPU stuck due to soft lockup ··· 4733 4728 static_branch_disable(&__scx_enabled); 4734 4729 for (i = SCX_OPI_BEGIN; i < SCX_OPI_END; i++) 4735 4730 static_branch_disable(&scx_has_op[i]); 4736 - static_branch_disable(&scx_ops_allow_queued_wakeup); 4737 4731 scx_idle_disable(); 4738 4732 synchronize_rcu(); 4739 4733 ··· 5371 5367 if (((void (**)(void))ops)[i]) 5372 5368 static_branch_enable(&scx_has_op[i]); 5373 5369 5374 - if (ops->flags & SCX_OPS_ALLOW_QUEUED_WAKEUP) 5375 - static_branch_enable(&scx_ops_allow_queued_wakeup); 5376 5370 if (scx_ops.cpu_acquire || scx_ops.cpu_release) 5377 5371 scx_ops.flags |= SCX_OPS_HAS_CPU_PREEMPT; 5378 5372
+1 -7
kernel/sched/ext.h
··· 21 21 void scx_rq_deactivate(struct rq *rq); 22 22 int scx_check_setscheduler(struct task_struct *p, int policy); 23 23 bool task_should_scx(int policy); 24 + bool scx_allow_ttwu_queue(const struct task_struct *p); 24 25 void init_sched_ext_class(void); 25 26 26 27 static inline u32 scx_cpuperf_target(s32 cpu) ··· 35 34 static inline bool task_on_scx(const struct task_struct *p) 36 35 { 37 36 return scx_enabled() && p->sched_class == &ext_sched_class; 38 - } 39 - 40 - static inline bool scx_allow_ttwu_queue(const struct task_struct *p) 41 - { 42 - return !scx_enabled() || 43 - static_branch_likely(&scx_ops_allow_queued_wakeup) || 44 - p->sched_class != &ext_sched_class; 45 37 } 46 38 47 39 #ifdef CONFIG_SCHED_CORE