aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2009-06-17 19:27:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:53 -0400
commit64a16caf5e3417ee32f670debcb5857b02a9e08e (patch)
tree1e32f8ac1ad0d7cefeeb6bfdac995ec1ad6d7396 /kernel/exit.c
parent9e8ae01d1c86dcaa6443c897662545d088036e4c (diff)
do_wait: simplify retval/tsk_result/notask_error mess
Now that we don't pass &retval down to other helpers we can simplify the code more. - kill tsk_result, just use retval - add the "notask" label right after the main loop, and s/got end/goto notask/ after the fastpath pid check. This way we don't need to initialize retval before this check and the code becomes a bit more clean, if this pid has no attached tasks we should just skip the list search. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 29622e468b7f..9c6881a0a8b4 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1576,27 +1576,22 @@ repeat:
1576 * might later match our criteria, even if we are not able to reap 1576 * might later match our criteria, even if we are not able to reap
1577 * it yet. 1577 * it yet.
1578 */ 1578 */
1579 retval = wo->notask_error = -ECHILD; 1579 wo->notask_error = -ECHILD;
1580 if ((wo->wo_type < PIDTYPE_MAX) && 1580 if ((wo->wo_type < PIDTYPE_MAX) &&
1581 (!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type]))) 1581 (!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type])))
1582 goto end; 1582 goto notask;
1583 1583
1584 current->state = TASK_INTERRUPTIBLE; 1584 current->state = TASK_INTERRUPTIBLE;
1585 read_lock(&tasklist_lock); 1585 read_lock(&tasklist_lock);
1586 tsk = current; 1586 tsk = current;
1587 do { 1587 do {
1588 int tsk_result = do_wait_thread(wo, tsk); 1588 retval = do_wait_thread(wo, tsk);
1589 1589 if (retval)
1590 if (!tsk_result) 1590 goto end;
1591 tsk_result = ptrace_do_wait(wo, tsk);
1592 1591
1593 if (tsk_result) { 1592 retval = ptrace_do_wait(wo, tsk);
1594 /* 1593 if (retval)
1595 * tasklist_lock is unlocked and we have a final result.
1596 */
1597 retval = tsk_result;
1598 goto end; 1594 goto end;
1599 }
1600 1595
1601 if (wo->wo_flags & __WNOTHREAD) 1596 if (wo->wo_flags & __WNOTHREAD)
1602 break; 1597 break;
@@ -1605,6 +1600,7 @@ repeat:
1605 } while (tsk != current); 1600 } while (tsk != current);
1606 read_unlock(&tasklist_lock); 1601 read_unlock(&tasklist_lock);
1607 1602
1603notask:
1608 retval = wo->notask_error; 1604 retval = wo->notask_error;
1609 if (!retval && !(wo->wo_flags & WNOHANG)) { 1605 if (!retval && !(wo->wo_flags & WNOHANG)) {
1610 retval = -ERESTARTSYS; 1606 retval = -ERESTARTSYS;