From 6c129e9b4b264f9d5967043e5e753e716cbc0982 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Tue, 21 May 2024 16:54:51 +0200 Subject: [PATCH] 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 --- rust/scx_rustland_core/assets/bpf/main.bpf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/scx_rustland_core/assets/bpf/main.bpf.c b/rust/scx_rustland_core/assets/bpf/main.bpf.c index d1836ad..0c932a1 100644 --- a/rust/scx_rustland_core/assets/bpf/main.bpf.c +++ b/rust/scx_rustland_core/assets/bpf/main.bpf.c @@ -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; + } } /*