]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Use SCX_TASK_READY test instead of tryget_task_struct() during class switch
authorTejun Heo <tj@kernel.org>
Tue, 28 Oct 2025 21:38:34 +0000 (11:38 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 28 Oct 2025 21:38:34 +0000 (11:38 -1000)
commitb7d4b28db7da89de1d03316c4e67b5a47390fcd3
treea0e32d74bbbd06728d5f20e083b2182d05c1b432
parentdcb938c4532872b42f1615b12776b9e6caf8ed91
sched_ext: Use SCX_TASK_READY test instead of tryget_task_struct() during class switch

ddf7233fcab6 ("sched/ext: Fix invalid task state transitions on class
switch") added tryget_task_struct() test during scx_enable()'s class
switching loop. The reason for the addition was to avoid enabling tasks which
skipped prep in the previous loop due to being dead.

While tryget_task_struct() does work for this purpose as tasks that fail
tryget always will fail it, it's a bit roundabout. A more direct way is
testing whether the task is in READY state. Switch to testing SCX_TASK_READY
directly.

Cc: Andrea Righi <arighi@nvidia.com>
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c