[PATCH] kernel/sched/fair: The CPU idle check can be placed before the CPU overload check

Li kunyu posted 1 patch 1 day, 12 hours ago
kernel/sched/fair.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] kernel/sched/fair: The CPU idle check can be placed before the CPU overload check
Posted by Li kunyu 1 day, 12 hours ago
Similarly, the "if (cpu_overutilized(i))" check primarily focuses on
checking for CFS task overload, including CPU overheating and wear
caused by overload. When the "if (!nr_running && idle_cpu(i))" check is
satisfied, overload issues are unlikely to occur. However, DL tasks are
not within the scope of these two checks, and their potential impact is
not considered.
Signed-off-by: Li kunyu <likunyu10@163.com>
---
 kernel/sched/fair.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d78467ec6ee1..00fed021ea22 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11819,9 +11819,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 		nr_running = rq->nr_running;
 		sgs->sum_nr_running += nr_running;
 
-		if (cpu_overutilized(i))
-			sgs->group_overutilized = 1;
-
 #ifdef CONFIG_SCHED_CACHE
 		if (sched_cache_enabled()) {
 			struct sched_domain *sd_tmp;
@@ -11849,6 +11846,9 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 		if (balancing_at_rd && nr_running > 1)
 			*sg_overloaded = 1;
 
+		if (cpu_overutilized(i))
+			sgs->group_overutilized = 1;
+
 #ifdef CONFIG_NUMA_BALANCING
 		/* Only fbq_classify_group() uses this to classify NUMA groups */
 		if (sd_flags & SD_NUMA) {
-- 
2.47.3