• Tejun Heo's avatar
    sched_ext: Reimplement scx_bpf_reenqueue_local() · fd0cf516
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Fixes: 245254f7 ("sched_ext: Implement sched_ext_ops.cpu_acquire/release()")
    Acked-by: default avatarDavid Vernet <void@manifault.com>
    fd0cf516
ext.c 181 KB