]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: Reimplement scx_bpf_reenqueue_local()
authorTejun Heo <tj@kernel.org>
Tue, 9 Jul 2024 22:30:26 +0000 (12:30 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 9 Jul 2024 22:30:26 +0000 (12:30 -1000)
commitfd0cf516956a0aaa4d899383ee5c2ff191418b5f
treea0077315d98419324d066d719ebeb553a8b733fa
parent6fbd643318a1a5f3caea7f94bfe035efbb293ddb
sched_ext: Reimplement scx_bpf_reenqueue_local()

scx_bpf_reenqueue_local() is used to re-enqueue tasks on the local DSQ from
ops.cpu_release(). Because the BPF scheduler may dispatch tasks to the same
local DSQ, to avoid processing the same tasks repeatedly, it first takes the
number of queued tasks and processes the task at the head of the queue that
number of times.

This is incorrect as a task can be dispatched to the same local DSQ with
SCX_ENQ_HEAD. Such a task will be processed repeatedly until the count is
exhausted and the succeeding tasks won't be processed at all.

Fix it by first moving all candidate tasks to a private list and then
processing that list. While at it, remove the WARNs. They're rather
superflous as later steps will check them anyway.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 245254f7081d ("sched_ext: Implement sched_ext_ops.cpu_acquire/release()")
Acked-by: David Vernet <void@manifault.com>
kernel/sched/ext.c