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 6901ddb150
commit 778ee1406f

View File

@ -662,17 +662,17 @@ void BPF_STRUCT_OPS(rustland_dispatch, s32 cpu, struct task_struct *prev)
*/ */
bpf_user_ringbuf_drain(&dispatched, handle_dispatched_task, NULL, 0); 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 */ /* Consume all tasks enqueued in the shared DSQ */
bpf_repeat(MAX_ENQUEUED_TASKS) { bpf_repeat(MAX_ENQUEUED_TASKS) {
if (!scx_bpf_consume(SHARED_DSQ)) if (!scx_bpf_consume(SHARED_DSQ))
break; 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;
}
} }
/* /*