summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt_guest/0111-overload-on-wakeup.patch
blob: 724e9a9936f0b44a8031674f01788d630ebf7eea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jplozi <jplozi@unice.fr>
Date: Fri, 11 Mar 2016 15:18:06 +0100
Subject: [PATCH] overload on wakeup

source https://github.com/jplozi/wastedcores

as an experiment, apply the learnings from the wasted-cores paper
and see how the performance works out. With the data from this we should
be able to work with Peter and the rest of the scheduler folks on
a more permanent/elegant solution.
---
 kernel/sched/fair.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c0c4d9ad7da8..a59694f24106 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6693,6 +6693,20 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
 	}
 
 	rcu_read_lock();
+
+	if (cpu_rq(prev_cpu)->nr_running) {
+		int _cpu;
+
+		for_each_online_cpu(_cpu) {
+			if (!cpumask_test_cpu(_cpu, p->cpus_ptr) ||
+				cpu_rq(_cpu)->nr_running)
+				continue;
+
+			rcu_read_unlock();
+			return _cpu;
+		}
+	}
+
 	for_each_domain(cpu, tmp) {
 		/*
 		 * If both 'cpu' and 'prev_cpu' are part of this domain,
-- 
https://clearlinux.org