diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-01-09 23:54:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:02:01 -0500 |
commit | 3795e1616f16905889761536cdc266ebc51855e5 (patch) | |
tree | 89e958009b621e83bc4eba0c9643743a3e06c3c8 /kernel | |
parent | a547dfe9563c49fd0f9743640e01d1d652119ec7 (diff) |
[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: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index e75a51f33768..802722814925 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1071,6 +1071,9 @@ static int wait_task_zombie(task_t *p, int noreap, | |||
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | if (likely(p->real_parent == p->parent) && likely(p->signal)) { | 1073 | if (likely(p->real_parent == p->parent) && likely(p->signal)) { |
1074 | struct signal_struct *psig; | ||
1075 | struct signal_struct *sig; | ||
1076 | |||
1074 | /* | 1077 | /* |
1075 | * The resource counters for the group leader are in its | 1078 | * The resource counters for the group leader are in its |
1076 | * own task_struct. Those for dead threads in the group | 1079 | * 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 | * here reaping other children at the same time. | 1090 | * here reaping other children at the same time. |
1088 | */ | 1091 | */ |
1089 | spin_lock_irq(&p->parent->sighand->siglock); | 1092 | spin_lock_irq(&p->parent->sighand->siglock); |
1090 | p->parent->signal->cutime = | 1093 | psig = p->parent->signal; |
1091 | cputime_add(p->parent->signal->cutime, | 1094 | sig = p->signal; |
1095 | psig->cutime = | ||
1096 | cputime_add(psig->cutime, | ||
1092 | cputime_add(p->utime, | 1097 | cputime_add(p->utime, |
1093 | cputime_add(p->signal->utime, | 1098 | cputime_add(sig->utime, |
1094 | p->signal->cutime))); | 1099 | sig->cutime))); |
1095 | p->parent->signal->cstime = | 1100 | psig->cstime = |
1096 | cputime_add(p->parent->signal->cstime, | 1101 | cputime_add(psig->cstime, |
1097 | cputime_add(p->stime, | 1102 | cputime_add(p->stime, |
1098 | cputime_add(p->signal->stime, | 1103 | cputime_add(sig->stime, |
1099 | p->signal->cstime))); | 1104 | sig->cstime))); |
1100 | p->parent->signal->cmin_flt += | 1105 | psig->cmin_flt += |
1101 | p->min_flt + p->signal->min_flt + p->signal->cmin_flt; | 1106 | p->min_flt + sig->min_flt + sig->cmin_flt; |
1102 | p->parent->signal->cmaj_flt += | 1107 | psig->cmaj_flt += |
1103 | p->maj_flt + p->signal->maj_flt + p->signal->cmaj_flt; | 1108 | p->maj_flt + sig->maj_flt + sig->cmaj_flt; |
1104 | p->parent->signal->cnvcsw += | 1109 | psig->cnvcsw += |
1105 | p->nvcsw + p->signal->nvcsw + p->signal->cnvcsw; | 1110 | p->nvcsw + sig->nvcsw + sig->cnvcsw; |
1106 | p->parent->signal->cnivcsw += | 1111 | psig->cnivcsw += |
1107 | p->nivcsw + p->signal->nivcsw + p->signal->cnivcsw; | 1112 | p->nivcsw + sig->nivcsw + sig->cnivcsw; |
1108 | spin_unlock_irq(&p->parent->sighand->siglock); | 1113 | spin_unlock_irq(&p->parent->sighand->siglock); |
1109 | } | 1114 | } |
1110 | 1115 | ||