mirror of
https://github.com/sched-ext/scx.git
synced 2024-11-24 20:00:22 +00:00
scx_rustland: prevent using SCX_DSQ_LOCAL_ON from enqueue()
When we fail to push a task to the queued BPF map we fallback to direct dispatch, but we can't use SCX_DSQ_LOCAL_ON. So, make sure to use SCX_DSQ_GLOBAL in this case to prevent scheduler crashes. Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
parent
05d997c539
commit
0c3bdb16fe
@ -295,6 +295,8 @@ static void dispatch_local(struct task_struct *p, u64 enq_flags)
|
||||
*/
|
||||
static s32 get_task_cpu(struct task_struct *p, s32 cpu)
|
||||
{
|
||||
if (cpu < 0)
|
||||
return cpu;
|
||||
/*
|
||||
* Check if the designated CPU can be used to dispatch the task.
|
||||
*/
|
||||
@ -482,7 +484,7 @@ void BPF_STRUCT_OPS(rustland_enqueue, struct task_struct *p, u64 enq_flags)
|
||||
if (bpf_map_push_elem(&queued, &task, 0)) {
|
||||
dbg_msg("scheduler congested: pid=%d", task.pid);
|
||||
__sync_fetch_and_add(&nr_sched_congested, 1);
|
||||
dispatch_task(p, task.cpu, enq_flags);
|
||||
dispatch_task(p, -1, enq_flags);
|
||||
__sync_fetch_and_add(&nr_kernel_dispatches, 1);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user