Commit 2019e8a3 authored by Frederic Weisbecker's avatar Frederic Weisbecker

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: default avatarRik 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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 031a7f45
...@@ -1138,6 +1138,7 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru) ...@@ -1138,6 +1138,7 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
{ {
struct rusage32 r; struct rusage32 r;
cputime_t utime, stime; cputime_t utime, stime;
unsigned long utime_jiffies, stime_jiffies;
if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN) if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
return -EINVAL; return -EINVAL;
...@@ -1146,14 +1147,18 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru) ...@@ -1146,14 +1147,18 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
switch (who) { switch (who) {
case RUSAGE_SELF: case RUSAGE_SELF:
task_cputime(current, &utime, &stime); task_cputime(current, &utime, &stime);
jiffies_to_timeval32(utime, &r.ru_utime); utime_jiffies = cputime_to_jiffies(utime);
jiffies_to_timeval32(stime, &r.ru_stime); 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_minflt = current->min_flt;
r.ru_majflt = current->maj_flt; r.ru_majflt = current->maj_flt;
break; break;
case RUSAGE_CHILDREN: case RUSAGE_CHILDREN:
jiffies_to_timeval32(current->signal->cutime, &r.ru_utime); utime_jiffies = cputime_to_jiffies(current->signal->cutime);
jiffies_to_timeval32(current->signal->cstime, &r.ru_stime); 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_minflt = current->signal->cmin_flt;
r.ru_majflt = current->signal->cmaj_flt; r.ru_majflt = current->signal->cmaj_flt;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment