From 7bf2eb2adcafbf637b0da00a16539c2998f96431 Mon Sep 17 00:00:00 2001 From: Cheng Yu Date: Thu, 15 May 2025 17:07:17 +0800 Subject: [PATCH] sched/fair: Fix the bug in dynamic smt when getting physical core load hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IC4CNP CVE: NA -------------------------------- Fix a bug in the dynamic smt feature. Specifically, when determining whether a physical core has idle capacity, there is a bug in obtaining the load of the core. We should use "core_id" instead of "cpu". Fixes: 5ea39a25cc45 ("sched/fair: Optimize the dynamic smt") Signed-off-by: Cheng Yu --- kernel/sched/fair.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5fc8d6a25b9a..5a191054d73f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7333,9 +7333,8 @@ int sysctl_sched_util_ratio = 100; static bool core_has_spare(int cpu) { int core_id = cpumask_first(cpu_smt_mask(cpu)); - struct rq *rq = cpu_rq(core_id); - unsigned long util = cpu_util(cpu); - unsigned long capacity = rq->cpu_capacity; + unsigned long util = cpu_util(core_id); + unsigned long capacity = capacity_of(core_id); if (sysctl_sched_util_ratio == 100) return true; -- Gitee