Commit cd424f97 authored by David Howells's avatar David Howells Committed by Kai Germaschewski

[PATCH] wait4() WIFSTOPPED starvation fix #2/2

This patch actually fixes the starvation bug in sys_wait4() by moving any
process which is serviced for stoppage to the end of the child list.
parent 4b035e53
......@@ -592,6 +592,12 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
if (!(options & WUNTRACED) && !(p->ptrace & PT_PTRACED))
continue;
read_unlock(&tasklist_lock);
/* move to end of parent's list to avoid starvation */
write_lock_irq(&tasklist_lock);
remove_parent(p);
add_parent(p, p->parent);
write_unlock_irq(&tasklist_lock);
retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
if (!retval && stat_addr)
retval = put_user((p->exit_code << 8) | 0x7f, stat_addr);
......
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