sched: debug: track maximum 'slice'
authorIngo Molnar <mingo@elte.hu>
Mon, 15 Oct 2007 15:00:02 +0000 (17:00 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 15 Oct 2007 15:00:02 +0000 (17:00 +0200)
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>
include/linux/sched.h
kernel/sched.c
kernel/sched_debug.c
kernel/sched_fair.c

index 833f7dc2b8de7ae5a822e15d1ce6c7d97564c9a4..9761b165d563aca3e99a810b20f02b7bb566a251 100644 (file)
@@ -921,6 +921,7 @@ struct sched_entity {
        u64                     block_start;
        u64                     block_max;
        u64                     exec_max;
+       u64                     slice_max;
 
        unsigned long           wait_runtime_overruns;
        unsigned long           wait_runtime_underruns;
index e92b185e371b5ae95058101713c6d25cedbe4e78..282d037c7300cd94e67a92c8ef41d408db28c429 100644 (file)
@@ -1603,6 +1603,7 @@ static void __sched_fork(struct task_struct *p)
        p->se.sleep_max                 = 0;
        p->se.block_max                 = 0;
        p->se.exec_max                  = 0;
+       p->se.slice_max                 = 0;
        p->se.wait_max                  = 0;
        p->se.wait_runtime_overruns     = 0;
        p->se.wait_runtime_underruns    = 0;
index 94915f1fd9deb575ca78fa0af3b83c5e1ab3f886..fd080f686f1824a4759ac1e73caa90a15ca8c859 100644 (file)
@@ -254,6 +254,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
        P(se.sleep_max);
        P(se.block_max);
        P(se.exec_max);
+       P(se.slice_max);
        P(se.wait_max);
        P(se.wait_runtime_overruns);
        P(se.wait_runtime_underruns);
@@ -282,6 +283,7 @@ void proc_sched_set_task(struct task_struct *p)
        p->se.sleep_max                 = 0;
        p->se.block_max                 = 0;
        p->se.exec_max                  = 0;
+       p->se.slice_max                 = 0;
        p->se.wait_max                  = 0;
        p->se.wait_runtime_overruns     = 0;
        p->se.wait_runtime_underruns    = 0;
index 0990b20fdcf523132e77fe5874c813125ade1e71..5c15d8ae92cb01064b74d61aa372774890cbaeb1 100644 (file)
@@ -739,6 +739,17 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
        update_stats_wait_end(cfs_rq, se);
        update_stats_curr_start(cfs_rq, se);
        set_cfs_rq_curr(cfs_rq, se);
+#ifdef CONFIG_SCHEDSTATS
+       /*
+        * Track our maximum slice length, if the CPU's load is at
+        * least twice that of our own weight (i.e. dont track it
+        * when there are only lesser-weight tasks around):
+        */
+       if (rq_of(cfs_rq)->ls.load.weight >= 2*se->load.weight) {
+               se->slice_max = max(se->slice_max,
+                       se->sum_exec_runtime - se->prev_sum_exec_runtime);
+       }
+#endif
        se->prev_sum_exec_runtime = se->sum_exec_runtime;
 }