scx_rustland_core: consume from the shared DSQ before local DSQ

The shared DSQ is typically used to prioritize tasks and dispatch them
on the first CPU available, so consume from the shared DSQ before the
local CPU DSQ.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi 2024-05-21 16:54:51 +02:00
parent 3be3b91c29
commit 6c129e9b4b

View File

@ -670,17 +670,17 @@ void BPF_STRUCT_OPS(rustland_dispatch, s32 cpu, struct task_struct *prev)
*/
bpf_user_ringbuf_drain(&dispatched, handle_dispatched_task, NULL, 0);
/* Consume all tasks enqueued in the current CPU's DSQ first */
bpf_repeat(MAX_ENQUEUED_TASKS) {
if (!scx_bpf_consume(cpu_to_dsq(cpu)))
break;
}
/* Consume all tasks enqueued in the shared DSQ */
bpf_repeat(MAX_ENQUEUED_TASKS) {
if (!scx_bpf_consume(SHARED_DSQ))
break;
}
/* Consume all tasks enqueued in the current CPU's DSQ first */
bpf_repeat(MAX_ENQUEUED_TASKS) {
if (!scx_bpf_consume(cpu_to_dsq(cpu)))
break;
}
}
/*