Messages in this thread Patch in this message |  | | | Subject | [PATCH] wait4() WIFSTOPPED starvation fix #2/2 | | Date | Fri, 15 Mar 2002 21:09:26 +0000 | | From | David Howells <> |
| |
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
diff -uNr linux-256p1/kernel/exit.c-orig linux-wait-256p1/kernel/exit.c --- linux-wait-256p1/kernel/exit.c-orig Fri Mar 15 19:05:47 2002 +++ linux-wait-256p1/kernel/exit.c Fri Mar 15 20:54:40 2002 @@ -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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |