提交 172ba844 编写于 作者: B Balbir Singh 提交者: Ingo Molnar

sched: update delay-accounting to use CFS's precise stats

update delay-accounting to use CFS's precise stats.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 b27f03d4
...@@ -296,7 +296,7 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer) ...@@ -296,7 +296,7 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
*/ */
static int proc_pid_schedstat(struct task_struct *task, char *buffer) static int proc_pid_schedstat(struct task_struct *task, char *buffer)
{ {
return sprintf(buffer, "%lu %lu %lu\n", return sprintf(buffer, "%llu %llu %lu\n",
task->sched_info.cpu_time, task->sched_info.cpu_time,
task->sched_info.run_delay, task->sched_info.run_delay,
task->sched_info.pcnt); task->sched_info.pcnt);
......
...@@ -562,13 +562,13 @@ struct reclaim_state; ...@@ -562,13 +562,13 @@ struct reclaim_state;
#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
struct sched_info { struct sched_info {
/* cumulative counters */ /* cumulative counters */
unsigned long cpu_time, /* time spent on the cpu */ unsigned long pcnt; /* # of times run on this cpu */
run_delay, /* time spent waiting on a runqueue */ unsigned long long cpu_time, /* time spent on the cpu */
pcnt; /* # of timeslices run on this cpu */ run_delay; /* time spent waiting on a runqueue */
/* timestamps */ /* timestamps */
unsigned long last_arrival, /* when we last ran on a cpu */ unsigned long long last_arrival,/* when we last ran on a cpu */
last_queued; /* when we were last queued to run */ last_queued; /* when we were last queued to run */
}; };
#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
......
...@@ -99,9 +99,10 @@ void __delayacct_blkio_end(void) ...@@ -99,9 +99,10 @@ void __delayacct_blkio_end(void)
int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
{ {
s64 tmp; s64 tmp;
struct timespec ts; unsigned long t1;
unsigned long t1,t2,t3; unsigned long long t2, t3;
unsigned long flags; unsigned long flags;
struct timespec ts;
/* Though tsk->delays accessed later, early exit avoids /* Though tsk->delays accessed later, early exit avoids
* unnecessary returning of other data * unnecessary returning of other data
...@@ -124,11 +125,10 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) ...@@ -124,11 +125,10 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
d->cpu_count += t1; d->cpu_count += t1;
jiffies_to_timespec(t2, &ts); tmp = (s64)d->cpu_delay_total + t2;
tmp = (s64)d->cpu_delay_total + timespec_to_ns(&ts);
d->cpu_delay_total = (tmp < (s64)d->cpu_delay_total) ? 0 : tmp; d->cpu_delay_total = (tmp < (s64)d->cpu_delay_total) ? 0 : tmp;
tmp = (s64)d->cpu_run_virtual_total + (s64)jiffies_to_usecs(t3) * 1000; tmp = (s64)d->cpu_run_virtual_total + t3;
d->cpu_run_virtual_total = d->cpu_run_virtual_total =
(tmp < (s64)d->cpu_run_virtual_total) ? 0 : tmp; (tmp < (s64)d->cpu_run_virtual_total) ? 0 : tmp;
......
...@@ -122,9 +122,9 @@ static void __exit_signal(struct task_struct *tsk) ...@@ -122,9 +122,9 @@ static void __exit_signal(struct task_struct *tsk)
sig->maj_flt += tsk->maj_flt; sig->maj_flt += tsk->maj_flt;
sig->nvcsw += tsk->nvcsw; sig->nvcsw += tsk->nvcsw;
sig->nivcsw += tsk->nivcsw; sig->nivcsw += tsk->nivcsw;
sig->sched_time += tsk->sched_time;
sig->inblock += task_io_get_inblock(tsk); sig->inblock += task_io_get_inblock(tsk);
sig->oublock += task_io_get_oublock(tsk); sig->oublock += task_io_get_oublock(tsk);
sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
sig = NULL; /* Marker for below. */ sig = NULL; /* Marker for below. */
} }
......
...@@ -877,7 +877,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts ...@@ -877,7 +877,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
sig->sched_time = 0; sig->sum_sched_runtime = 0;
INIT_LIST_HEAD(&sig->cpu_timers[0]); INIT_LIST_HEAD(&sig->cpu_timers[0]);
INIT_LIST_HEAD(&sig->cpu_timers[1]); INIT_LIST_HEAD(&sig->cpu_timers[1]);
INIT_LIST_HEAD(&sig->cpu_timers[2]); INIT_LIST_HEAD(&sig->cpu_timers[2]);
...@@ -1040,7 +1040,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, ...@@ -1040,7 +1040,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->utime = cputime_zero; p->utime = cputime_zero;
p->stime = cputime_zero; p->stime = cputime_zero;
p->sched_time = 0;
#ifdef CONFIG_TASK_XACCT #ifdef CONFIG_TASK_XACCT
p->rchar = 0; /* I/O counter: bytes read */ p->rchar = 0; /* I/O counter: bytes read */
p->wchar = 0; /* I/O counter: bytes written */ p->wchar = 0; /* I/O counter: bytes written */
......
...@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v) ...@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
/* runqueue-specific stats */ /* runqueue-specific stats */
seq_printf(seq, seq_printf(seq,
"cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", "cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %llu %llu %lu",
cpu, rq->yld_both_empty, cpu, rq->yld_both_empty,
rq->yld_act_empty, rq->yld_exp_empty, rq->yld_cnt, rq->yld_act_empty, rq->yld_exp_empty, rq->yld_cnt,
rq->sched_switch, rq->sched_cnt, rq->sched_goidle, rq->sched_switch, rq->sched_cnt, rq->sched_goidle,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册