wait4() WIFSTOPPED starvation fix #2/2
PATCH 1/1 wait4() WIFSTOPPED starvation fix #2/2
Hi Linus,
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.
David
kernel/exit.c renamed from kernel/exit.c-orig +6 -0
@@ -592,6 +592,12 @@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); +list_del (&p->sibling); +list_add_tail (&p->sibling,&p->parent->children); +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);