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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190506044836.2914-7-luca.abeni@santannapisa.it>
Date:   Mon,  6 May 2019 06:48:36 +0200
From:   Luca Abeni <luca.abeni@...tannapisa.it>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        "Paul E . McKenney" <paulmck@...ux.ibm.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Quentin Perret <quentin.perret@....com>,
        Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Patrick Bellasi <patrick.bellasi@....com>,
        Tommaso Cucinotta <tommaso.cucinotta@...tannapisa.it>,
        luca abeni <luca.abeni@...tannapisa.it>
Subject: [RFC PATCH 6/6] sched/dl: Try not to select a too fast core

From: luca abeni <luca.abeni@...tannapisa.it>

When a task can fit on multiple CPU cores, try to select the slowest
core that is able to properly serve the task. This avoids useless
future migrations, leaving the "fast cores" idle for more heavyweight
tasks.

Signed-off-by: luca abeni <luca.abeni@...tannapisa.it>
---
 kernel/sched/cpudeadline.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 2a4ac7b529b7..897ed71af515 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -143,17 +143,24 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
 	       struct cpumask *later_mask)
 {
 	const struct sched_dl_entity *dl_se = &p->dl;
+	struct cpumask tmp_mask;
 
 	if (later_mask &&
-	    cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) {
+	    cpumask_and(&tmp_mask, cp->free_cpus, &p->cpus_allowed)) {
 		int cpu, max_cpu = -1;
-		u64 max_cap = 0;
+		u64 max_cap = 0, min_cap = SCHED_CAPACITY_SCALE * SCHED_CAPACITY_SCALE;
 
-		for_each_cpu(cpu, later_mask) {
+		cpumask_clear(later_mask);
+		for_each_cpu(cpu, &tmp_mask) {
 			u64 cap;
 
-			if (!dl_task_fit(&p->dl, cpu, &cap))
-				cpumask_clear_cpu(cpu, later_mask);
+			if (dl_task_fit(&p->dl, cpu, &cap) && (cap <= min_cap)) {
+				if (cap < min_cap) {
+					min_cap = cap;
+					cpumask_clear(later_mask);
+				}
+				cpumask_set_cpu(cpu, later_mask);
+			}
 
 			if (cap > max_cap) {
 				max_cap = cap;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ