From 3e5c86d4bd3b6a23304885ab8da63a72261c5a02 Mon Sep 17 00:00:00 2001 From: Cheng-Yang Chou Date: Wed, 28 May 2025 03:59:20 +0800 Subject: [PATCH] scx_bpfland: Simplify idle_smt conditional in kick_idle_cpu Apply Boolen distributive law: !a || (a && b) = (!a || a) && (!a || b) = TRUE && (!a || b) = !a || b to improve readability by removing redundant logic. Co-authored-by: Po-Ying Chiu Signed-off-by: Cheng-Yang Chou --- scheds/rust/scx_bpfland/src/bpf/main.bpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scheds/rust/scx_bpfland/src/bpf/main.bpf.c b/scheds/rust/scx_bpfland/src/bpf/main.bpf.c index 56b9c8ca5a..15b105210d 100644 --- a/scheds/rust/scx_bpfland/src/bpf/main.bpf.c +++ b/scheds/rust/scx_bpfland/src/bpf/main.bpf.c @@ -57,7 +57,7 @@ const volatile bool no_wake_sync; */ const volatile bool local_kthreads; - /* +/* * Prioritize per-CPU tasks (tasks that can only run on a single CPU). * * This allows to prioritize per-CPU tasks that usually tend to be @@ -432,7 +432,7 @@ static void task_update_domain(struct task_struct *p, struct task_ctx *tctx, /* * Refresh task's recently used CPU every time the task's domain - * is updated.. + * is updated. */ tctx->recent_used_cpu = cpu; @@ -854,7 +854,7 @@ static bool kick_idle_cpu(const struct task_struct *p, const struct task_ctx *tc /* * Try to reuse the same CPU if idle. */ - if (!idle_smt || (idle_smt && is_fully_idle(prev_cpu))) { + if (!idle_smt || is_fully_idle(prev_cpu)) { if (scx_bpf_test_and_clear_cpu_idle(prev_cpu)) { scx_bpf_kick_cpu(prev_cpu, SCX_KICK_IDLE); return true;