lkml.org 
[lkml]   [2011]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 1/4] sched: add members to struct sched_info to save maximum
This patch adds members to struct sched_info and save max delays
into it.

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
---
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



\
 
 \ /
  Last update: 2011-11-28 23:47    [W:0.071 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site