summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt/0113-overload-on-wakeup.patch
blob: a3a6bce4b3eb24bc8455a4288ee4239c98376108 (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 9f25d18f45a8391488feb9783404f2f79b7090f4 Mon Sep 17 00:00:00 2001
From: jplozi <jplozi@unice.fr>
Date: Fri, 11 Mar 2016 15:18:06 +0100
Subject: [PATCH 113/124] 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 c242944f5cbd..5132c828161e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5638,6 +5638,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, tsk_cpus_allowed(p)) ||
+				cpu_rq(_cpu)->nr_running)
+				continue;
+
+			rcu_read_unlock();
+			return _cpu;
+		}
+	}
+
 	for_each_domain(cpu, tmp) {
 		if (!(tmp->flags & SD_LOAD_BALANCE))
 			break;
-- 
2.11.1