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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231209011759.398021-2-qyousef@layalina.io>
Date:   Sat,  9 Dec 2023 01:17:57 +0000
From:   Qais Yousef <qyousef@...alina.io>
To:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>
Cc:     linux-kernel@...r.kernel.org, Lukasz Luba <lukasz.luba@....com>,
        Wei Wang <wvw@...gle.com>, Rick Yiu <rickyiu@...gle.com>,
        Chung-Kai Mei <chungkai@...gle.com>,
        Qais Yousef <qyousef@...alina.io>
Subject: [PATCH 1/3] sched/fair: Add is_misfit_task() function

Split it from update_misfit_status(). Use it in detach_tasks() and
update_sg_lb_wakeup_stats().

This should help us generalize misfit lb to handle more than
upmigration.

Signed-off-by: Qais Yousef (Google) <qyousef@...alina.io>
---
 kernel/sched/fair.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bcea3d55d95d..eb9e891182cc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5063,17 +5063,23 @@ static inline int task_fits_cpu(struct task_struct *p, int cpu)
 	return (util_fits_cpu(util, uclamp_min, uclamp_max, cpu) > 0);
 }
 
+static inline int is_misfit_task(struct task_struct *p, struct rq *rq)
+{
+	if (!p || p->nr_cpus_allowed == 1)
+		return 0;
+
+	if (task_fits_cpu(p, cpu_of(rq)))
+		return 0;
+
+	return 1;
+}
+
 static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
 {
 	if (!sched_asym_cpucap_active())
 		return;
 
-	if (!p || p->nr_cpus_allowed == 1) {
-		rq->misfit_task_load = 0;
-		return;
-	}
-
-	if (task_fits_cpu(p, cpu_of(rq))) {
+	if (!is_misfit_task(p, rq)) {
 		rq->misfit_task_load = 0;
 		return;
 	}
@@ -9105,7 +9111,7 @@ static int detach_tasks(struct lb_env *env)
 
 		case migrate_misfit:
 			/* This is not a misfit task */
-			if (task_fits_cpu(p, env->src_cpu))
+			if (!is_misfit_task(p, cpu_rq(env->src_cpu)))
 				goto next;
 
 			env->imbalance = 0;
@@ -10207,7 +10213,7 @@ static inline void update_sg_wakeup_stats(struct sched_domain *sd,
 		/* Check if task fits in the CPU */
 		if (sd->flags & SD_ASYM_CPUCAPACITY &&
 		    sgs->group_misfit_task_load &&
-		    task_fits_cpu(p, i))
+		    !is_misfit_task(p, rq))
 			sgs->group_misfit_task_load = 0;
 
 	}
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ