Commit e80d0a1ae8bb8fee0edd37427836f108b30f596b

Authored by Frederic Weisbecker
1 parent a634f93335

cputime: Rename thread_group_times to thread_group_cputime_adjusted

We have thread_group_cputime() and thread_group_times(). The naming
doesn't provide enough information about the difference between
these two APIs.

To lower the confusion, rename thread_group_times() to
thread_group_cputime_adjusted(). This name better suggests that
it's a version of thread_group_cputime() that does some stabilization
on the raw cputime values. ie here: scale on top of CFS runtime
stats and bound lower value for monotonicity.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>

Showing 5 changed files with 13 additions and 13 deletions Side-by-side Diff

... ... @@ -438,7 +438,7 @@
438 438  
439 439 min_flt += sig->min_flt;
440 440 maj_flt += sig->maj_flt;
441   - thread_group_times(task, &utime, &stime);
  441 + thread_group_cputime_adjusted(task, &utime, &stime);
442 442 gtime += sig->gtime;
443 443 }
444 444  
... ... @@ -454,7 +454,7 @@
454 454 if (!whole) {
455 455 min_flt = task->min_flt;
456 456 maj_flt = task->maj_flt;
457   - task_times(task, &utime, &stime);
  457 + task_cputime_adjusted(task, &utime, &stime);
458 458 gtime = task->gtime;
459 459 }
460 460  
include/linux/sched.h
... ... @@ -1751,8 +1751,8 @@
1751 1751 __put_task_struct(t);
1752 1752 }
1753 1753  
1754   -extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1755   -extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
  1754 +extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
  1755 +extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1756 1756  
1757 1757 /*
1758 1758 * Per process flags
... ... @@ -1186,11 +1186,11 @@
1186 1186 * as other threads in the parent group can be right
1187 1187 * here reaping other children at the same time.
1188 1188 *
1189   - * We use thread_group_times() to get times for the thread
  1189 + * We use thread_group_cputime_adjusted() to get times for the thread
1190 1190 * group, which consolidates times for all threads in the
1191 1191 * group including the group leader.
1192 1192 */
1193   - thread_group_times(p, &tgutime, &tgstime);
  1193 + thread_group_cputime_adjusted(p, &tgutime, &tgstime);
1194 1194 spin_lock_irq(&p->real_parent->sighand->siglock);
1195 1195 psig = p->real_parent->signal;
1196 1196 sig = p->signal;
kernel/sched/cputime.c
... ... @@ -445,13 +445,13 @@
445 445 * Use precise platform statistics if available:
446 446 */
447 447 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
448   -void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
  448 +void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
449 449 {
450 450 *ut = p->utime;
451 451 *st = p->stime;
452 452 }
453 453  
454   -void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
  454 +void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
455 455 {
456 456 struct task_cputime cputime;
457 457  
... ... @@ -516,7 +516,7 @@
516 516 return (__force cputime_t) temp;
517 517 }
518 518  
519   -void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
  519 +void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
520 520 {
521 521 cputime_t rtime, utime = p->utime, total = utime + p->stime;
522 522  
... ... @@ -543,7 +543,7 @@
543 543 /*
544 544 * Must be called with siglock held.
545 545 */
546   -void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
  546 +void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
547 547 {
548 548 struct signal_struct *sig = p->signal;
549 549 struct task_cputime cputime;
... ... @@ -1046,7 +1046,7 @@
1046 1046 cputime_t tgutime, tgstime, cutime, cstime;
1047 1047  
1048 1048 spin_lock_irq(&current->sighand->siglock);
1049   - thread_group_times(current, &tgutime, &tgstime);
  1049 + thread_group_cputime_adjusted(current, &tgutime, &tgstime);
1050 1050 cutime = current->signal->cutime;
1051 1051 cstime = current->signal->cstime;
1052 1052 spin_unlock_irq(&current->sighand->siglock);
... ... @@ -1704,7 +1704,7 @@
1704 1704 utime = stime = 0;
1705 1705  
1706 1706 if (who == RUSAGE_THREAD) {
1707   - task_times(current, &utime, &stime);
  1707 + task_cputime_adjusted(current, &utime, &stime);
1708 1708 accumulate_thread_rusage(p, r);
1709 1709 maxrss = p->signal->maxrss;
1710 1710 goto out;
... ... @@ -1730,7 +1730,7 @@
1730 1730 break;
1731 1731  
1732 1732 case RUSAGE_SELF:
1733   - thread_group_times(p, &tgutime, &tgstime);
  1733 + thread_group_cputime_adjusted(p, &tgutime, &tgstime);
1734 1734 utime += tgutime;
1735 1735 stime += tgstime;
1736 1736 r->ru_nvcsw += p->signal->nvcsw;