summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2012-08-08 10:41:23 +0200
committerDenys Dmytriyenko <denys@ti.com>2012-09-14 01:50:52 -0400
commit6203cbca5c9df9095882544f1eaa370a9cbd364a (patch)
tree737bb49b9f53b00ef177a9efbf648d0c0e5b7f0a /recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
parente4ea426bb5e7b9dc18cd9fc1e820744c05b63561 (diff)
downloadmeta-ti-6203cbca5c9df9095882544f1eaa370a9cbd364a.tar.gz
linux-ti33x-psp 3.2: update to 3.2.25
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch137
1 files changed, 137 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
new file mode 100644
index 00000000..6548d426
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
@@ -0,0 +1,137 @@
1From af56d9e56ec0729f6aa8c3a51b9bddbdcd8dfcf0 Mon Sep 17 00:00:00 2001
2From: Peter Zijlstra <a.p.zijlstra@chello.nl>
3Date: Fri, 11 May 2012 17:31:26 +0200
4Subject: [PATCH 18/73] sched/nohz: Fix rq->cpu_load[] calculations
5
6commit 556061b00c9f2fd6a5524b6bde823ef12f299ecf upstream.
7
8While investigating why the load-balancer did funny I found that the
9rq->cpu_load[] tables were completely screwy.. a bit more digging
10revealed that the updates that got through were missing ticks followed
11by a catchup of 2 ticks.
12
13The catchup assumes the cpu was idle during that time (since only nohz
14can cause missed ticks and the machine is idle etc..) this means that
15esp. the higher indices were significantly lower than they ought to
16be.
17
18The reason for this is that its not correct to compare against jiffies
19on every jiffy on any other cpu than the cpu that updates jiffies.
20
21This patch cludges around it by only doing the catch-up stuff from
22nohz_idle_balance() and doing the regular stuff unconditionally from
23the tick.
24
25Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
26Cc: pjt@google.com
27Cc: Venkatesh Pallipadi <venki@google.com>
28Link: http://lkml.kernel.org/n/tip-tp4kj18xdd5aj4vvj0qg55s2@git.kernel.org
29Signed-off-by: Ingo Molnar <mingo@kernel.org>
30[bwh: Backported to 3.2: adjust filenames and context; keep functions static]
31Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
32---
33 kernel/sched.c | 53 ++++++++++++++++++++++++++++++++++++++------------
34 kernel/sched_fair.c | 2 +-
35 2 files changed, 41 insertions(+), 14 deletions(-)
36
37diff --git a/kernel/sched.c b/kernel/sched.c
38index 52ac69b..a409d81 100644
39--- a/kernel/sched.c
40+++ b/kernel/sched.c
41@@ -1887,7 +1887,7 @@ static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
42
43 static void update_sysctl(void);
44 static int get_update_sysctl_factor(void);
45-static void update_cpu_load(struct rq *this_rq);
46+static void update_idle_cpu_load(struct rq *this_rq);
47
48 static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
49 {
50@@ -3855,22 +3855,13 @@ decay_load_missed(unsigned long load, unsigned long missed_updates, int idx)
51 * scheduler tick (TICK_NSEC). With tickless idle this will not be called
52 * every tick. We fix it up based on jiffies.
53 */
54-static void update_cpu_load(struct rq *this_rq)
55+static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
56+ unsigned long pending_updates)
57 {
58- unsigned long this_load = this_rq->load.weight;
59- unsigned long curr_jiffies = jiffies;
60- unsigned long pending_updates;
61 int i, scale;
62
63 this_rq->nr_load_updates++;
64
65- /* Avoid repeated calls on same jiffy, when moving in and out of idle */
66- if (curr_jiffies == this_rq->last_load_update_tick)
67- return;
68-
69- pending_updates = curr_jiffies - this_rq->last_load_update_tick;
70- this_rq->last_load_update_tick = curr_jiffies;
71-
72 /* Update our load: */
73 this_rq->cpu_load[0] = this_load; /* Fasttrack for idx 0 */
74 for (i = 1, scale = 2; i < CPU_LOAD_IDX_MAX; i++, scale += scale) {
75@@ -3895,9 +3886,45 @@ static void update_cpu_load(struct rq *this_rq)
76 sched_avg_update(this_rq);
77 }
78
79+/*
80+ * Called from nohz_idle_balance() to update the load ratings before doing the
81+ * idle balance.
82+ */
83+static void update_idle_cpu_load(struct rq *this_rq)
84+{
85+ unsigned long curr_jiffies = jiffies;
86+ unsigned long load = this_rq->load.weight;
87+ unsigned long pending_updates;
88+
89+ /*
90+ * Bloody broken means of dealing with nohz, but better than nothing..
91+ * jiffies is updated by one cpu, another cpu can drift wrt the jiffy
92+ * update and see 0 difference the one time and 2 the next, even though
93+ * we ticked at roughtly the same rate.
94+ *
95+ * Hence we only use this from nohz_idle_balance() and skip this
96+ * nonsense when called from the scheduler_tick() since that's
97+ * guaranteed a stable rate.
98+ */
99+ if (load || curr_jiffies == this_rq->last_load_update_tick)
100+ return;
101+
102+ pending_updates = curr_jiffies - this_rq->last_load_update_tick;
103+ this_rq->last_load_update_tick = curr_jiffies;
104+
105+ __update_cpu_load(this_rq, load, pending_updates);
106+}
107+
108+/*
109+ * Called from scheduler_tick()
110+ */
111 static void update_cpu_load_active(struct rq *this_rq)
112 {
113- update_cpu_load(this_rq);
114+ /*
115+ * See the mess in update_idle_cpu_load().
116+ */
117+ this_rq->last_load_update_tick = jiffies;
118+ __update_cpu_load(this_rq, this_rq->load.weight, 1);
119
120 calc_load_account_active(this_rq);
121 }
122diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
123index 8a39fa3..66e4576 100644
124--- a/kernel/sched_fair.c
125+++ b/kernel/sched_fair.c
126@@ -4735,7 +4735,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)
127
128 raw_spin_lock_irq(&this_rq->lock);
129 update_rq_clock(this_rq);
130- update_cpu_load(this_rq);
131+ update_idle_cpu_load(this_rq);
132 raw_spin_unlock_irq(&this_rq->lock);
133
134 rebalance_domains(balance_cpu, CPU_IDLE);
135--
1361.7.7.6
137