aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-10-15 11:00:02 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:02 -0400
commiteba1ed4b7e52720e3099325874811c38a5ec1562 (patch)
tree4ce145dd10b6cc248a2bc3463822dff23f9dd3c5
parenta4b29ba2f72673aaa60ba11ced74d579771dd578 (diff)
sched: debug: track maximum 'slice'
track the maximum amount of time a task has executed while the CPU load was at least 2x. (i.e. at least two nice-0 tasks were runnable) Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Mike Galbraith <efault@gmx.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/sched.c1
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_fair.c11
4 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 833f7dc2b8de..9761b165d563 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -921,6 +921,7 @@ struct sched_entity {
921 u64 block_start; 921 u64 block_start;
922 u64 block_max; 922 u64 block_max;
923 u64 exec_max; 923 u64 exec_max;
924 u64 slice_max;
924 925
925 unsigned long wait_runtime_overruns; 926 unsigned long wait_runtime_overruns;
926 unsigned long wait_runtime_underruns; 927 unsigned long wait_runtime_underruns;
diff --git a/kernel/sched.c b/kernel/sched.c
index e92b185e371b..282d037c7300 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1603,6 +1603,7 @@ static void __sched_fork(struct task_struct *p)
1603 p->se.sleep_max = 0; 1603 p->se.sleep_max = 0;
1604 p->se.block_max = 0; 1604 p->se.block_max = 0;
1605 p->se.exec_max = 0; 1605 p->se.exec_max = 0;
1606 p->se.slice_max = 0;
1606 p->se.wait_max = 0; 1607 p->se.wait_max = 0;
1607 p->se.wait_runtime_overruns = 0; 1608 p->se.wait_runtime_overruns = 0;
1608 p->se.wait_runtime_underruns = 0; 1609 p->se.wait_runtime_underruns = 0;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 94915f1fd9de..fd080f686f18 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -254,6 +254,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
254 P(se.sleep_max); 254 P(se.sleep_max);
255 P(se.block_max); 255 P(se.block_max);
256 P(se.exec_max); 256 P(se.exec_max);
257 P(se.slice_max);
257 P(se.wait_max); 258 P(se.wait_max);
258 P(se.wait_runtime_overruns); 259 P(se.wait_runtime_overruns);
259 P(se.wait_runtime_underruns); 260 P(se.wait_runtime_underruns);
@@ -282,6 +283,7 @@ void proc_sched_set_task(struct task_struct *p)
282 p->se.sleep_max = 0; 283 p->se.sleep_max = 0;
283 p->se.block_max = 0; 284 p->se.block_max = 0;
284 p->se.exec_max = 0; 285 p->se.exec_max = 0;
286 p->se.slice_max = 0;
285 p->se.wait_max = 0; 287 p->se.wait_max = 0;
286 p->se.wait_runtime_overruns = 0; 288 p->se.wait_runtime_overruns = 0;
287 p->se.wait_runtime_underruns = 0; 289 p->se.wait_runtime_underruns = 0;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 0990b20fdcf5..5c15d8ae92cb 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -739,6 +739,17 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
739 update_stats_wait_end(cfs_rq, se); 739 update_stats_wait_end(cfs_rq, se);
740 update_stats_curr_start(cfs_rq, se); 740 update_stats_curr_start(cfs_rq, se);
741 set_cfs_rq_curr(cfs_rq, se); 741 set_cfs_rq_curr(cfs_rq, se);
742#ifdef CONFIG_SCHEDSTATS
743 /*
744 * Track our maximum slice length, if the CPU's load is at
745 * least twice that of our own weight (i.e. dont track it
746 * when there are only lesser-weight tasks around):
747 */
748 if (rq_of(cfs_rq)->ls.load.weight >= 2*se->load.weight) {
749 se->slice_max = max(se->slice_max,
750 se->sum_exec_runtime - se->prev_sum_exec_runtime);
751 }
752#endif
742 se->prev_sum_exec_runtime = se->sum_exec_runtime; 753 se->prev_sum_exec_runtime = se->sum_exec_runtime;
743} 754}
744 755