lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230621071605.3853119-1-linmiaohe@huawei.com>
Date:   Wed, 21 Jun 2023 15:16:05 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <mingo@...hat.com>, <peterz@...radead.org>,
        <juri.lelli@...hat.com>, <vincent.guittot@...aro.org>
CC:     <dietmar.eggemann@....com>, <rostedt@...dmis.org>,
        <bsegall@...gle.com>, <mgorman@...e.de>, <bristot@...hat.com>,
        <vschneid@...hat.com>, <linux-kernel@...r.kernel.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH] sched/fair: fix returning possible non-optimal candidate

In best_fits < 0 case, best_thermal_cap > prev_thermal_cap is checked to
determine whether best_energy_cpu should be returned. But prev_fits can
be > 0 in this case and it should be preferred.

Fixes: e5ed0550c04c ("sched/fair: unlink misfit task from cpu overutilized")
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 28ff831ee847..a4e300fc44be 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7684,7 +7684,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
 
 	if ((best_fits > prev_fits) ||
 	    ((best_fits > 0) && (best_delta < prev_delta)) ||
-	    ((best_fits < 0) && (best_thermal_cap > prev_thermal_cap)))
+	    ((best_fits < 0) && (prev_fits < 0) && (best_thermal_cap > prev_thermal_cap)))
 		target = best_energy_cpu;
 
 	return target;
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ