mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
getrusage: add the "signal_struct *sig" local variable
No functional changes, cleanup/preparation. Link: https://lkml.kernel.org/r/20230909172554.GA20441@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
e5ecf29c50
commit
c7ac8231ac
37
kernel/sys.c
37
kernel/sys.c
|
@ -1786,6 +1786,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u64 tgutime, tgstime, utime, stime;
|
u64 tgutime, tgstime, utime, stime;
|
||||||
unsigned long maxrss = 0;
|
unsigned long maxrss = 0;
|
||||||
|
struct signal_struct *sig = p->signal;
|
||||||
|
|
||||||
memset((char *)r, 0, sizeof (*r));
|
memset((char *)r, 0, sizeof (*r));
|
||||||
utime = stime = 0;
|
utime = stime = 0;
|
||||||
|
@ -1793,7 +1794,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
|
||||||
if (who == RUSAGE_THREAD) {
|
if (who == RUSAGE_THREAD) {
|
||||||
task_cputime_adjusted(current, &utime, &stime);
|
task_cputime_adjusted(current, &utime, &stime);
|
||||||
accumulate_thread_rusage(p, r);
|
accumulate_thread_rusage(p, r);
|
||||||
maxrss = p->signal->maxrss;
|
maxrss = sig->maxrss;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1803,15 +1804,15 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
|
||||||
switch (who) {
|
switch (who) {
|
||||||
case RUSAGE_BOTH:
|
case RUSAGE_BOTH:
|
||||||
case RUSAGE_CHILDREN:
|
case RUSAGE_CHILDREN:
|
||||||
utime = p->signal->cutime;
|
utime = sig->cutime;
|
||||||
stime = p->signal->cstime;
|
stime = sig->cstime;
|
||||||
r->ru_nvcsw = p->signal->cnvcsw;
|
r->ru_nvcsw = sig->cnvcsw;
|
||||||
r->ru_nivcsw = p->signal->cnivcsw;
|
r->ru_nivcsw = sig->cnivcsw;
|
||||||
r->ru_minflt = p->signal->cmin_flt;
|
r->ru_minflt = sig->cmin_flt;
|
||||||
r->ru_majflt = p->signal->cmaj_flt;
|
r->ru_majflt = sig->cmaj_flt;
|
||||||
r->ru_inblock = p->signal->cinblock;
|
r->ru_inblock = sig->cinblock;
|
||||||
r->ru_oublock = p->signal->coublock;
|
r->ru_oublock = sig->coublock;
|
||||||
maxrss = p->signal->cmaxrss;
|
maxrss = sig->cmaxrss;
|
||||||
|
|
||||||
if (who == RUSAGE_CHILDREN)
|
if (who == RUSAGE_CHILDREN)
|
||||||
break;
|
break;
|
||||||
|
@ -1821,14 +1822,14 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
|
||||||
thread_group_cputime_adjusted(p, &tgutime, &tgstime);
|
thread_group_cputime_adjusted(p, &tgutime, &tgstime);
|
||||||
utime += tgutime;
|
utime += tgutime;
|
||||||
stime += tgstime;
|
stime += tgstime;
|
||||||
r->ru_nvcsw += p->signal->nvcsw;
|
r->ru_nvcsw += sig->nvcsw;
|
||||||
r->ru_nivcsw += p->signal->nivcsw;
|
r->ru_nivcsw += sig->nivcsw;
|
||||||
r->ru_minflt += p->signal->min_flt;
|
r->ru_minflt += sig->min_flt;
|
||||||
r->ru_majflt += p->signal->maj_flt;
|
r->ru_majflt += sig->maj_flt;
|
||||||
r->ru_inblock += p->signal->inblock;
|
r->ru_inblock += sig->inblock;
|
||||||
r->ru_oublock += p->signal->oublock;
|
r->ru_oublock += sig->oublock;
|
||||||
if (maxrss < p->signal->maxrss)
|
if (maxrss < sig->maxrss)
|
||||||
maxrss = p->signal->maxrss;
|
maxrss = sig->maxrss;
|
||||||
t = p;
|
t = p;
|
||||||
do {
|
do {
|
||||||
accumulate_thread_rusage(t, r);
|
accumulate_thread_rusage(t, r);
|
||||||
|
|
Loading…
Reference in a new issue