History

sched_ext: Fix stale errno in scx_sub_enable_workfn()

The nesting depth check and the cgroup online check in scx_sub_enable_workfn() reach err_disable without setting ret, so the fallback error added by commit db4e9defd2e8 ("sched_ext: Record an error on errno-only sub-enable failure") reports "scx_sub_enable() failed (0)". This is currently harmless because both paths record their own scx_error() first and the first error wins, but it leaves the fallback broken for these paths. Set -EINVAL and -ENODEV there so the fallback always reports a real errno. v2: The validate_ops() path from v1 is already fixed in for-7.3 (sub.c already has ret = scx_validate_ops()), so only the two remaining paths are addressed.

Cui Jian committed 3 months ago

Commit 00a08dd1 parent 2abee441 file · +2 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/ext/sub.c+2−0
@@ -1331,6 +1331,7 @@ void scx_sub_enable_workfn(struct kthread_work *work) · 1330 unmodified lines
1331 if (sch->level >= SCX_SUB_MAX_DEPTH) {1331 if (sch->level >= SCX_SUB_MAX_DEPTH) {
1332 scx_error(sch, "max nesting depth %d violated",1332 scx_error(sch, "max nesting depth %d violated",
1333 SCX_SUB_MAX_DEPTH);1333 SCX_SUB_MAX_DEPTH);
1334 ret = -EINVAL;
1334 goto err_disable;1335 goto err_disable;
1335 }1336 }
1336 1337
@@ -1378,6 +1379,7 @@ void scx_sub_enable_workfn(struct kthread_work *work) · 41 unmodified lines
1378 set_cgroup_sched(sch_cgroup(sch), sch);1379 set_cgroup_sched(sch_cgroup(sch), sch);
1379 if (!(cgrp->self.flags & CSS_ONLINE)) {1380 if (!(cgrp->self.flags & CSS_ONLINE)) {
1380 scx_error(sch, "cgroup is not online");1381 scx_error(sch, "cgroup is not online");
1382 ret = -ENODEV;
1381 goto err_unlock_and_disable;1383 goto err_unlock_and_disable;
1382 }1384 }
1383 1385