Commit 64a16caf authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

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: default avatarOleg Nesterov <>
Cc: Ingo Molnar <>
Acked-by: default avatarRoland McGrath <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 9e8ae01d
......@@ -1576,27 +1576,22 @@ repeat:
* might later match our criteria, even if we are not able to reap
* it yet.
retval = wo->notask_error = -ECHILD;
wo->notask_error = -ECHILD;
if ((wo->wo_type < PIDTYPE_MAX) &&
(!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type])))
goto end;
goto notask;
current->state = TASK_INTERRUPTIBLE;
tsk = current;
do {
int tsk_result = do_wait_thread(wo, tsk);
if (!tsk_result)
tsk_result = ptrace_do_wait(wo, tsk);
retval = do_wait_thread(wo, tsk);
if (retval)
goto end;
if (tsk_result) {
* tasklist_lock is unlocked and we have a final result.
retval = tsk_result;
retval = ptrace_do_wait(wo, tsk);
if (retval)
goto end;
if (wo->wo_flags & __WNOTHREAD)
......@@ -1605,6 +1600,7 @@ repeat:
} while (tsk != current);
retval = wo->notask_error;
if (!retval && !(wo->wo_flags & WNOHANG)) {
retval = -ERESTARTSYS;
Supports Markdown
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