Skip to content

Commit cc3e1ca

Browse files
committed
sched_ext: Move scx_buildin_idle_enabled check to scx_bpf_select_cpu_dfl()
Move the sanity check from the inner function scx_select_cpu_dfl() to the exported kfunc scx_bpf_select_cpu_dfl(). This doesn't cause behavior differences and will allow using scx_select_cpu_dfl() in bypass mode regardless of scx_builtin_idle_enabled. Signed-off-by: Tejun Heo <[email protected]>
1 parent 3fdb9eb commit cc3e1ca

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

kernel/sched/ext.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,11 +3062,6 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,
30623062

30633063
*found = false;
30643064

3065-
if (!static_branch_likely(&scx_builtin_idle_enabled)) {
3066-
scx_ops_error("built-in idle tracking is disabled");
3067-
return prev_cpu;
3068-
}
3069-
30703065
/*
30713066
* If WAKE_SYNC, the waker's local DSQ is empty, and the system is
30723067
* under utilized, wake up @p to the local DSQ of the waker. Checking
@@ -5870,16 +5865,21 @@ __bpf_kfunc_start_defs();
58705865
__bpf_kfunc s32 scx_bpf_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,
58715866
u64 wake_flags, bool *is_idle)
58725867
{
5873-
if (!scx_kf_allowed(SCX_KF_SELECT_CPU)) {
5874-
*is_idle = false;
5875-
return prev_cpu;
5868+
if (!static_branch_likely(&scx_builtin_idle_enabled)) {
5869+
scx_ops_error("built-in idle tracking is disabled");
5870+
goto prev_cpu;
58765871
}
5872+
5873+
if (!scx_kf_allowed(SCX_KF_SELECT_CPU))
5874+
goto prev_cpu;
5875+
58775876
#ifdef CONFIG_SMP
58785877
return scx_select_cpu_dfl(p, prev_cpu, wake_flags, is_idle);
5879-
#else
5878+
#endif
5879+
5880+
prev_cpu:
58805881
*is_idle = false;
58815882
return prev_cpu;
5882-
#endif
58835883
}
58845884

58855885
__bpf_kfunc_end_defs();

0 commit comments

Comments
 (0)