]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: Make task_can_run_on_remote_rq() use common task_allowed_on_cpu()
authorTejun Heo <tj@kernel.org>
Tue, 6 Aug 2024 19:40:11 +0000 (09:40 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 6 Aug 2024 19:40:11 +0000 (09:40 -1000)
commit2c390dda9e03d7936c492224453342d458e9bf98
tree73eca702cc84b22364bfac307ac92b06d646ca99
parent9390a923e109f85b242bf676dc5bc81958d447fa
sched_ext: Make task_can_run_on_remote_rq() use common task_allowed_on_cpu()

task_can_run_on_remote_rq() is similar to is_cpu_allowed() but there are
subtle differences. It currently open codes all the tests. This is
cumbersome to understand and error-prone in case the intersecting tests need
to be updated.

Factor out the common part - testing whether the task is allowed on the CPU
at all regardless of the CPU state - into task_allowed_on_cpu() and make
both is_cpu_allowed() and SCX's task_can_run_on_remote_rq() use it. As the
code is now linked between the two and each contains only the extra tests
that differ between them, it's less error-prone when the conditions need to
be updated. Also, improve the comment to explain why they are different.

v2: Replace accidental "extern inline" with "static inline" (Peter).

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: David Vernet <void@manifault.com>
kernel/sched/core.c
kernel/sched/ext.c
kernel/sched/sched.h