Commit 3795e161 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] Decrease number of pointer derefs in exit.c

Decrease the number of pointer derefs in kernel/exit.c

Benefits of the patch:
 - Fewer pointer dereferences should make the code slightly faster.
 - Size of generated code is smaller
 - improved readability
Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a547dfe9
...@@ -1071,6 +1071,9 @@ static int wait_task_zombie(task_t *p, int noreap, ...@@ -1071,6 +1071,9 @@ static int wait_task_zombie(task_t *p, int noreap,
} }
if (likely(p->real_parent == p->parent) && likely(p->signal)) { if (likely(p->real_parent == p->parent) && likely(p->signal)) {
struct signal_struct *psig;
struct signal_struct *sig;
/* /*
* The resource counters for the group leader are in its * The resource counters for the group leader are in its
* own task_struct. Those for dead threads in the group * own task_struct. Those for dead threads in the group
...@@ -1087,24 +1090,26 @@ static int wait_task_zombie(task_t *p, int noreap, ...@@ -1087,24 +1090,26 @@ static int wait_task_zombie(task_t *p, int noreap,
* here reaping other children at the same time. * here reaping other children at the same time.
*/ */
spin_lock_irq(&p->parent->sighand->siglock); spin_lock_irq(&p->parent->sighand->siglock);
p->parent->signal->cutime = psig = p->parent->signal;
cputime_add(p->parent->signal->cutime, sig = p->signal;
psig->cutime =
cputime_add(psig->cutime,
cputime_add(p->utime, cputime_add(p->utime,
cputime_add(p->signal->utime, cputime_add(sig->utime,
p->signal->cutime))); sig->cutime)));
p->parent->signal->cstime = psig->cstime =
cputime_add(p->parent->signal->cstime, cputime_add(psig->cstime,
cputime_add(p->stime, cputime_add(p->stime,
cputime_add(p->signal->stime, cputime_add(sig->stime,
p->signal->cstime))); sig->cstime)));
p->parent->signal->cmin_flt += psig->cmin_flt +=
p->min_flt + p->signal->min_flt + p->signal->cmin_flt; p->min_flt + sig->min_flt + sig->cmin_flt;
p->parent->signal->cmaj_flt += psig->cmaj_flt +=
p->maj_flt + p->signal->maj_flt + p->signal->cmaj_flt; p->maj_flt + sig->maj_flt + sig->cmaj_flt;
p->parent->signal->cnvcsw += psig->cnvcsw +=
p->nvcsw + p->signal->nvcsw + p->signal->cnvcsw; p->nvcsw + sig->nvcsw + sig->cnvcsw;
p->parent->signal->cnivcsw += psig->cnivcsw +=
p->nivcsw + p->signal->nivcsw + p->signal->cnivcsw; p->nivcsw + sig->nivcsw + sig->cnivcsw;
spin_unlock_irq(&p->parent->sighand->siglock); spin_unlock_irq(&p->parent->sighand->siglock);
} }
......
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