From: Feng Yang <[email protected]>

When __COMPAT_scx_bpf_pick_idle_cpu_node selects an idle CPU,
it reports that the CPU should be marked as busy.

Fixes: 5ae5161820e5 ("selftests/sched_ext: Add NUMA-aware scheduler test")
Signed-off-by: Feng Yang <[email protected]>
---
 tools/testing/selftests/sched_ext/numa.bpf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/sched_ext/numa.bpf.c 
b/tools/testing/selftests/sched_ext/numa.bpf.c
index a79d86ed54a1..98423628b05c 100644
--- a/tools/testing/selftests/sched_ext/numa.bpf.c
+++ b/tools/testing/selftests/sched_ext/numa.bpf.c
@@ -44,12 +44,12 @@ s32 BPF_STRUCT_OPS(numa_select_cpu,
         */
        cpu = __COMPAT_scx_bpf_pick_idle_cpu_node(p->cpus_ptr, node,
                                        __COMPAT_SCX_PICK_IDLE_IN_NODE);
-       if (cpu < 0)
+       if (cpu < 0) {
                cpu = __COMPAT_scx_bpf_pick_any_cpu_node(p->cpus_ptr, node,
                                                __COMPAT_SCX_PICK_IDLE_IN_NODE);
-
-       if (is_cpu_idle(cpu, node))
-               scx_bpf_error("CPU %d should be marked as busy", cpu);
+               if (is_cpu_idle(cpu, node))
+                       scx_bpf_error("CPU %d should be marked as busy", cpu);
+       }
 
        if (__COMPAT_scx_bpf_cpu_node(cpu) != node)
                scx_bpf_error("CPU %d should be in node %d", cpu, node);
-- 
2.43.0


Reply via email to