aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c28
-rw-r--r--kernel/sched_debug.c22
-rw-r--r--kernel/sched_fair.c4
-rw-r--r--kernel/sched_rt.c4
4 files changed, 38 insertions, 20 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a9d374061a46..72bb9483d949 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -983,18 +983,21 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
983 u64 clock_offset, fair_clock_offset; 983 u64 clock_offset, fair_clock_offset;
984 984
985 clock_offset = old_rq->clock - new_rq->clock; 985 clock_offset = old_rq->clock - new_rq->clock;
986 fair_clock_offset = old_rq->cfs.fair_clock - 986 fair_clock_offset = old_rq->cfs.fair_clock - new_rq->cfs.fair_clock;
987 new_rq->cfs.fair_clock; 987
988 if (p->se.wait_start)
989 p->se.wait_start -= clock_offset;
990 if (p->se.wait_start_fair) 988 if (p->se.wait_start_fair)
991 p->se.wait_start_fair -= fair_clock_offset; 989 p->se.wait_start_fair -= fair_clock_offset;
990 if (p->se.sleep_start_fair)
991 p->se.sleep_start_fair -= fair_clock_offset;
992
993#ifdef CONFIG_SCHEDSTATS
994 if (p->se.wait_start)
995 p->se.wait_start -= clock_offset;
992 if (p->se.sleep_start) 996 if (p->se.sleep_start)
993 p->se.sleep_start -= clock_offset; 997 p->se.sleep_start -= clock_offset;
994 if (p->se.block_start) 998 if (p->se.block_start)
995 p->se.block_start -= clock_offset; 999 p->se.block_start -= clock_offset;
996 if (p->se.sleep_start_fair) 1000#endif
997 p->se.sleep_start_fair -= fair_clock_offset;
998 1001
999 __set_task_cpu(p, new_cpu); 1002 __set_task_cpu(p, new_cpu);
1000} 1003}
@@ -1555,17 +1558,19 @@ int fastcall wake_up_state(struct task_struct *p, unsigned int state)
1555static void __sched_fork(struct task_struct *p) 1558static void __sched_fork(struct task_struct *p)
1556{ 1559{
1557 p->se.wait_start_fair = 0; 1560 p->se.wait_start_fair = 0;
1558 p->se.wait_start = 0;
1559 p->se.exec_start = 0; 1561 p->se.exec_start = 0;
1560 p->se.sum_exec_runtime = 0; 1562 p->se.sum_exec_runtime = 0;
1561 p->se.delta_exec = 0; 1563 p->se.delta_exec = 0;
1562 p->se.delta_fair_run = 0; 1564 p->se.delta_fair_run = 0;
1563 p->se.delta_fair_sleep = 0; 1565 p->se.delta_fair_sleep = 0;
1564 p->se.wait_runtime = 0; 1566 p->se.wait_runtime = 0;
1567 p->se.sleep_start_fair = 0;
1568
1569#ifdef CONFIG_SCHEDSTATS
1570 p->se.wait_start = 0;
1565 p->se.sum_wait_runtime = 0; 1571 p->se.sum_wait_runtime = 0;
1566 p->se.sum_sleep_runtime = 0; 1572 p->se.sum_sleep_runtime = 0;
1567 p->se.sleep_start = 0; 1573 p->se.sleep_start = 0;
1568 p->se.sleep_start_fair = 0;
1569 p->se.block_start = 0; 1574 p->se.block_start = 0;
1570 p->se.sleep_max = 0; 1575 p->se.sleep_max = 0;
1571 p->se.block_max = 0; 1576 p->se.block_max = 0;
@@ -1573,6 +1578,7 @@ static void __sched_fork(struct task_struct *p)
1573 p->se.wait_max = 0; 1578 p->se.wait_max = 0;
1574 p->se.wait_runtime_overruns = 0; 1579 p->se.wait_runtime_overruns = 0;
1575 p->se.wait_runtime_underruns = 0; 1580 p->se.wait_runtime_underruns = 0;
1581#endif
1576 1582
1577 INIT_LIST_HEAD(&p->run_list); 1583 INIT_LIST_HEAD(&p->run_list);
1578 p->se.on_rq = 0; 1584 p->se.on_rq = 0;
@@ -6579,12 +6585,14 @@ void normalize_rt_tasks(void)
6579 do_each_thread(g, p) { 6585 do_each_thread(g, p) {
6580 p->se.fair_key = 0; 6586 p->se.fair_key = 0;
6581 p->se.wait_runtime = 0; 6587 p->se.wait_runtime = 0;
6588 p->se.exec_start = 0;
6582 p->se.wait_start_fair = 0; 6589 p->se.wait_start_fair = 0;
6590 p->se.sleep_start_fair = 0;
6591#ifdef CONFIG_SCHEDSTATS
6583 p->se.wait_start = 0; 6592 p->se.wait_start = 0;
6584 p->se.exec_start = 0;
6585 p->se.sleep_start = 0; 6593 p->se.sleep_start = 0;
6586 p->se.sleep_start_fair = 0;
6587 p->se.block_start = 0; 6594 p->se.block_start = 0;
6595#endif
6588 task_rq(p)->cfs.fair_clock = 0; 6596 task_rq(p)->cfs.fair_clock = 0;
6589 task_rq(p)->clock = 0; 6597 task_rq(p)->clock = 0;
6590 6598
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 0eca442b7792..1c61e5315ad2 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -44,11 +44,16 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p, u64 now)
44 (long long)p->se.wait_runtime, 44 (long long)p->se.wait_runtime,
45 (long long)(p->nvcsw + p->nivcsw), 45 (long long)(p->nvcsw + p->nivcsw),
46 p->prio, 46 p->prio,
47#ifdef CONFIG_SCHEDSTATS
47 (long long)p->se.sum_exec_runtime, 48 (long long)p->se.sum_exec_runtime,
48 (long long)p->se.sum_wait_runtime, 49 (long long)p->se.sum_wait_runtime,
49 (long long)p->se.sum_sleep_runtime, 50 (long long)p->se.sum_sleep_runtime,
50 (long long)p->se.wait_runtime_overruns, 51 (long long)p->se.wait_runtime_overruns,
51 (long long)p->se.wait_runtime_underruns); 52 (long long)p->se.wait_runtime_underruns
53#else
54 0LL, 0LL, 0LL, 0LL, 0LL
55#endif
56 );
52} 57}
53 58
54static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now) 59static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now)
@@ -171,7 +176,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
171 u64 now = ktime_to_ns(ktime_get()); 176 u64 now = ktime_to_ns(ktime_get());
172 int cpu; 177 int cpu;
173 178
174 SEQ_printf(m, "Sched Debug Version: v0.05, %s %.*s\n", 179 SEQ_printf(m, "Sched Debug Version: v0.05-v20, %s %.*s\n",
175 init_utsname()->release, 180 init_utsname()->release,
176 (int)strcspn(init_utsname()->version, " "), 181 (int)strcspn(init_utsname()->version, " "),
177 init_utsname()->version); 182 init_utsname()->version);
@@ -235,21 +240,24 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
235#define P(F) \ 240#define P(F) \
236 SEQ_printf(m, "%-25s:%20Ld\n", #F, (long long)p->F) 241 SEQ_printf(m, "%-25s:%20Ld\n", #F, (long long)p->F)
237 242
238 P(se.wait_start); 243 P(se.wait_runtime);
239 P(se.wait_start_fair); 244 P(se.wait_start_fair);
240 P(se.exec_start); 245 P(se.exec_start);
241 P(se.sleep_start);
242 P(se.sleep_start_fair); 246 P(se.sleep_start_fair);
247 P(se.sum_exec_runtime);
248
249#ifdef CONFIG_SCHEDSTATS
250 P(se.wait_start);
251 P(se.sleep_start);
243 P(se.block_start); 252 P(se.block_start);
244 P(se.sleep_max); 253 P(se.sleep_max);
245 P(se.block_max); 254 P(se.block_max);
246 P(se.exec_max); 255 P(se.exec_max);
247 P(se.wait_max); 256 P(se.wait_max);
248 P(se.wait_runtime);
249 P(se.wait_runtime_overruns); 257 P(se.wait_runtime_overruns);
250 P(se.wait_runtime_underruns); 258 P(se.wait_runtime_underruns);
251 P(se.sum_wait_runtime); 259 P(se.sum_wait_runtime);
252 P(se.sum_exec_runtime); 260#endif
253 SEQ_printf(m, "%-25s:%20Ld\n", 261 SEQ_printf(m, "%-25s:%20Ld\n",
254 "nr_switches", (long long)(p->nvcsw + p->nivcsw)); 262 "nr_switches", (long long)(p->nvcsw + p->nivcsw));
255 P(se.load.weight); 263 P(se.load.weight);
@@ -269,7 +277,9 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
269 277
270void proc_sched_set_task(struct task_struct *p) 278void proc_sched_set_task(struct task_struct *p)
271{ 279{
280#ifdef CONFIG_SCHEDSTATS
272 p->se.sleep_max = p->se.block_max = p->se.exec_max = p->se.wait_max = 0; 281 p->se.sleep_max = p->se.block_max = p->se.exec_max = p->se.wait_max = 0;
273 p->se.wait_runtime_overruns = p->se.wait_runtime_underruns = 0; 282 p->se.wait_runtime_overruns = p->se.wait_runtime_underruns = 0;
283#endif
274 p->se.sum_exec_runtime = 0; 284 p->se.sum_exec_runtime = 0;
275} 285}
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5bf7285ad02c..6f579ff5a9bc 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -349,7 +349,7 @@ static inline void
349update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 349update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
350{ 350{
351 se->wait_start_fair = cfs_rq->fair_clock; 351 se->wait_start_fair = cfs_rq->fair_clock;
352 se->wait_start = now; 352 schedstat_set(se->wait_start, now);
353} 353}
354 354
355/* 355/*
@@ -447,7 +447,7 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
447 } 447 }
448 448
449 se->wait_start_fair = 0; 449 se->wait_start_fair = 0;
450 se->wait_start = 0; 450 schedstat_set(se->wait_start, 0);
451} 451}
452 452
453static inline void 453static inline void
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index ade20dc422f1..002fcf8d3f64 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -18,8 +18,8 @@ static inline void update_curr_rt(struct rq *rq, u64 now)
18 delta_exec = now - curr->se.exec_start; 18 delta_exec = now - curr->se.exec_start;
19 if (unlikely((s64)delta_exec < 0)) 19 if (unlikely((s64)delta_exec < 0))
20 delta_exec = 0; 20 delta_exec = 0;
21 if (unlikely(delta_exec > curr->se.exec_max)) 21
22 curr->se.exec_max = delta_exec; 22 schedstat_set(curr->se.exec_max, max(curr->se.exec_max, delta_exec));
23 23
24 curr->se.sum_exec_runtime += delta_exec; 24 curr->se.sum_exec_runtime += delta_exec;
25 curr->se.exec_start = now; 25 curr->se.exec_start = now;