alpha: Fix jiffies based cputime assumption
That code wrongly assumes that cputime_t wraps jiffies_t. Lets use the correct accessors/mutators. In practice there should be no harm yet because alpha currently only support tick based cputime accounting which is always jiffies based. Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Christoph Lameter <cl@linux.com> Cc: Ingo Molnar <mingo@kernel.org> Cc; John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
parent
031a7f456a
commit
2019e8a302
1 changed files with 9 additions and 4 deletions
|
@ -1138,6 +1138,7 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
|
|||
{
|
||||
struct rusage32 r;
|
||||
cputime_t utime, stime;
|
||||
unsigned long utime_jiffies, stime_jiffies;
|
||||
|
||||
if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
|
||||
return -EINVAL;
|
||||
|
@ -1146,14 +1147,18 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
|
|||
switch (who) {
|
||||
case RUSAGE_SELF:
|
||||
task_cputime(current, &utime, &stime);
|
||||
jiffies_to_timeval32(utime, &r.ru_utime);
|
||||
jiffies_to_timeval32(stime, &r.ru_stime);
|
||||
utime_jiffies = cputime_to_jiffies(utime);
|
||||
stime_jiffies = cputime_to_jiffies(stime);
|
||||
jiffies_to_timeval32(utime_jiffies, &r.ru_utime);
|
||||
jiffies_to_timeval32(stime_jiffies, &r.ru_stime);
|
||||
r.ru_minflt = current->min_flt;
|
||||
r.ru_majflt = current->maj_flt;
|
||||
break;
|
||||
case RUSAGE_CHILDREN:
|
||||
jiffies_to_timeval32(current->signal->cutime, &r.ru_utime);
|
||||
jiffies_to_timeval32(current->signal->cstime, &r.ru_stime);
|
||||
utime_jiffies = cputime_to_jiffies(current->signal->cutime);
|
||||
stime_jiffies = cputime_to_jiffies(current->signal->cstime);
|
||||
jiffies_to_timeval32(utime_jiffies, &r.ru_utime);
|
||||
jiffies_to_timeval32(stime_jiffies, &r.ru_stime);
|
||||
r.ru_minflt = current->signal->cmin_flt;
|
||||
r.ru_majflt = current->signal->cmaj_flt;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue