diff options
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index ce17760d9c51..9968c5fb55b9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -911,16 +911,15 @@ change_okay: | |||
911 | 911 | ||
912 | void do_sys_times(struct tms *tms) | 912 | void do_sys_times(struct tms *tms) |
913 | { | 913 | { |
914 | struct task_cputime cputime; | 914 | cputime_t tgutime, tgstime, cutime, cstime; |
915 | cputime_t cutime, cstime; | ||
916 | 915 | ||
917 | thread_group_cputime(current, &cputime); | ||
918 | spin_lock_irq(¤t->sighand->siglock); | 916 | spin_lock_irq(¤t->sighand->siglock); |
917 | thread_group_times(current, &tgutime, &tgstime); | ||
919 | cutime = current->signal->cutime; | 918 | cutime = current->signal->cutime; |
920 | cstime = current->signal->cstime; | 919 | cstime = current->signal->cstime; |
921 | spin_unlock_irq(¤t->sighand->siglock); | 920 | spin_unlock_irq(¤t->sighand->siglock); |
922 | tms->tms_utime = cputime_to_clock_t(cputime.utime); | 921 | tms->tms_utime = cputime_to_clock_t(tgutime); |
923 | tms->tms_stime = cputime_to_clock_t(cputime.stime); | 922 | tms->tms_stime = cputime_to_clock_t(tgstime); |
924 | tms->tms_cutime = cputime_to_clock_t(cutime); | 923 | tms->tms_cutime = cputime_to_clock_t(cutime); |
925 | tms->tms_cstime = cputime_to_clock_t(cstime); | 924 | tms->tms_cstime = cputime_to_clock_t(cstime); |
926 | } | 925 | } |
@@ -1338,16 +1337,14 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) | |||
1338 | { | 1337 | { |
1339 | struct task_struct *t; | 1338 | struct task_struct *t; |
1340 | unsigned long flags; | 1339 | unsigned long flags; |
1341 | cputime_t utime, stime; | 1340 | cputime_t tgutime, tgstime, utime, stime; |
1342 | struct task_cputime cputime; | ||
1343 | unsigned long maxrss = 0; | 1341 | unsigned long maxrss = 0; |
1344 | 1342 | ||
1345 | memset((char *) r, 0, sizeof *r); | 1343 | memset((char *) r, 0, sizeof *r); |
1346 | utime = stime = cputime_zero; | 1344 | utime = stime = cputime_zero; |
1347 | 1345 | ||
1348 | if (who == RUSAGE_THREAD) { | 1346 | if (who == RUSAGE_THREAD) { |
1349 | utime = task_utime(current); | 1347 | task_times(current, &utime, &stime); |
1350 | stime = task_stime(current); | ||
1351 | accumulate_thread_rusage(p, r); | 1348 | accumulate_thread_rusage(p, r); |
1352 | maxrss = p->signal->maxrss; | 1349 | maxrss = p->signal->maxrss; |
1353 | goto out; | 1350 | goto out; |
@@ -1373,9 +1370,9 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) | |||
1373 | break; | 1370 | break; |
1374 | 1371 | ||
1375 | case RUSAGE_SELF: | 1372 | case RUSAGE_SELF: |
1376 | thread_group_cputime(p, &cputime); | 1373 | thread_group_times(p, &tgutime, &tgstime); |
1377 | utime = cputime_add(utime, cputime.utime); | 1374 | utime = cputime_add(utime, tgutime); |
1378 | stime = cputime_add(stime, cputime.stime); | 1375 | stime = cputime_add(stime, tgstime); |
1379 | r->ru_nvcsw += p->signal->nvcsw; | 1376 | r->ru_nvcsw += p->signal->nvcsw; |
1380 | r->ru_nivcsw += p->signal->nivcsw; | 1377 | r->ru_nivcsw += p->signal->nivcsw; |
1381 | r->ru_minflt += p->signal->min_flt; | 1378 | r->ru_minflt += p->signal->min_flt; |