[PATCH 1/4] sched: add members to struct sched_info to save maximum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds members to struct sched_info and save max delays
into it.

Signed-off-by: Satoru Moriya <satoru.moriya@xxxxxxx>
---
 include/linux/sched.h |    2 ++
 kernel/sched_stats.h  |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1c4f3e9..1665e2c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -736,6 +736,8 @@ struct sched_info {
 	/* cumulative counters */
 	unsigned long pcount;	      /* # of times run on this cpu */
 	unsigned long long run_delay; /* time spent waiting on a runqueue */
+	unsigned long long max_delay; /* max run_delay */
+	unsigned long long prev_cpu_delay; /* time spent waiting on prev cpus' runqueue */
 
 	/* timestamps */
 	unsigned long long last_arrival,/* when we last ran on a cpu */
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 87f9e36..48e9db9 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -171,6 +171,7 @@ static inline void sched_info_dequeued(struct task_struct *t)
 			delta = now - t->sched_info.last_queued;
 	sched_info_reset_dequeued(t);
 	t->sched_info.run_delay += delta;
+	t->sched_info.prev_cpu_delay += delta;
 
 	rq_sched_info_dequeued(task_rq(t), delta);
 }
@@ -190,6 +191,10 @@ static void sched_info_arrive(struct task_struct *t)
 	t->sched_info.run_delay += delta;
 	t->sched_info.last_arrival = now;
 	t->sched_info.pcount++;
+	t->sched_info.prev_cpu_delay += delta;
+	if (t->sched_info.max_delay < t->sched_info.prev_cpu_delay)
+		t->sched_info.max_delay = t->sched_info.prev_cpu_delay;
+	t->sched_info.prev_cpu_delay = 0;
 
 	rq_sched_info_arrive(task_rq(t), delta);
 }
-- 
1.7.6.4


--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux