Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.21

Andi Kleen (ak@suse.de)
19 Jun 2003 18:42:31 +0200


Ray Bryant <raybry@sgi.com> writes:
>
> select() and poll() call a common routine: __pollwait(). On the
> first call to __pollwait(), it calls __get_free_page(GFP_KERNEL) to
> allocate a table to hold wait queues. In the natural course of things,
> this calls into __alloc_pages(). In low memory situations, the process
> can then end up in the rebalance code at the bottom of __alloc_pages()
> where there is a call to yield(). If the process makes this call, this
> is a bad thing [tm], since the process state at that point is
> TASK_INTERRUPTIBLE. There is no wait queue yet for the process (that is
> done later in __pollwait()) and no schedule timeout event has yet been
> created (that is done later in select()) so the process will never
> return from the call to yield().

Nasty bug. How about adding a BUG() for current->state != TASK_RUNNING at
the beginning of __alloc_pages unless GFP_ATOMIC is set?

-Andi
-
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/