aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/array.c4
-rw-r--r--include/linux/sched.h3
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/sched.c33
4 files changed, 5 insertions, 37 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 330deda70d08..ca61a88aed66 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -511,7 +511,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
511 do { 511 do {
512 min_flt += t->min_flt; 512 min_flt += t->min_flt;
513 maj_flt += t->maj_flt; 513 maj_flt += t->maj_flt;
514 gtime = cputime_add(gtime, task_gtime(t)); 514 gtime = cputime_add(gtime, t->gtime);
515 t = next_thread(t); 515 t = next_thread(t);
516 } while (t != task); 516 } while (t != task);
517 517
@@ -536,7 +536,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
536 min_flt = task->min_flt; 536 min_flt = task->min_flt;
537 maj_flt = task->maj_flt; 537 maj_flt = task->maj_flt;
538 task_times(task, &utime, &stime); 538 task_times(task, &utime, &stime);
539 gtime = task_gtime(task); 539 gtime = task->gtime;
540 } 540 }
541 541
542 /* scale priority and nice values from timeslices to -20..20 */ 542 /* scale priority and nice values from timeslices to -20..20 */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fe6ae1516640..0395b0f4df3a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1720,9 +1720,6 @@ static inline void put_task_struct(struct task_struct *t)
1720 __put_task_struct(t); 1720 __put_task_struct(t);
1721} 1721}
1722 1722
1723extern cputime_t task_utime(struct task_struct *p);
1724extern cputime_t task_stime(struct task_struct *p);
1725extern cputime_t task_gtime(struct task_struct *p);
1726extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1723extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1727 1724
1728/* 1725/*
diff --git a/kernel/exit.c b/kernel/exit.c
index 29068ab2670a..2eaf68b634e3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -115,7 +115,7 @@ static void __exit_signal(struct task_struct *tsk)
115 task_times(tsk, &utime, &stime); 115 task_times(tsk, &utime, &stime);
116 sig->utime = cputime_add(sig->utime, utime); 116 sig->utime = cputime_add(sig->utime, utime);
117 sig->stime = cputime_add(sig->stime, stime); 117 sig->stime = cputime_add(sig->stime, stime);
118 sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); 118 sig->gtime = cputime_add(sig->gtime, tsk->gtime);
119 sig->min_flt += tsk->min_flt; 119 sig->min_flt += tsk->min_flt;
120 sig->maj_flt += tsk->maj_flt; 120 sig->maj_flt += tsk->maj_flt;
121 sig->nvcsw += tsk->nvcsw; 121 sig->nvcsw += tsk->nvcsw;
diff --git a/kernel/sched.c b/kernel/sched.c
index 475a6f2b7158..82251c21f785 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5182,22 +5182,12 @@ void account_idle_ticks(unsigned long ticks)
5182 * Use precise platform statistics if available: 5182 * Use precise platform statistics if available:
5183 */ 5183 */
5184#ifdef CONFIG_VIRT_CPU_ACCOUNTING 5184#ifdef CONFIG_VIRT_CPU_ACCOUNTING
5185cputime_t task_utime(struct task_struct *p)
5186{
5187 return p->utime;
5188}
5189
5190cputime_t task_stime(struct task_struct *p)
5191{
5192 return p->stime;
5193}
5194
5195void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) 5185void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
5196{ 5186{
5197 if (ut) 5187 if (ut)
5198 *ut = task_utime(p); 5188 *ut = p->utime;
5199 if (st) 5189 if (st)
5200 *st = task_stime(p); 5190 *st = p->stime;
5201} 5191}
5202#else 5192#else
5203 5193
@@ -5235,27 +5225,8 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
5235 if (st) 5225 if (st)
5236 *st = p->prev_stime; 5226 *st = p->prev_stime;
5237} 5227}
5238
5239cputime_t task_utime(struct task_struct *p)
5240{
5241 cputime_t utime;
5242 task_times(p, &utime, NULL);
5243 return utime;
5244}
5245
5246cputime_t task_stime(struct task_struct *p)
5247{
5248 cputime_t stime;
5249 task_times(p, NULL, &stime);
5250 return stime;
5251}
5252#endif 5228#endif
5253 5229
5254inline cputime_t task_gtime(struct task_struct *p)
5255{
5256 return p->gtime;
5257}
5258
5259/* 5230/*
5260 * This function gets called by the timer code, with HZ frequency. 5231 * This function gets called by the timer code, with HZ frequency.
5261 * We call it with interrupts disabled. 5232 * We call it with interrupts disabled.