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

Andrew Morton (akpm@digeo.com)
Thu, 19 Jun 2003 11:21:02 -0700


Ray Bryant <raybry@sgi.com> wrote:
>
> > The correct fix is current->state = TASK_RUNNING just before calling
> > yield() in the rebalance code.
>
> But doesn't this have the same kind of problem? e. g., just before
> calling yield() in the rebalance code we save current->state, set it to
> TASK_RUNNING, then restore current->state on return from yield(). If a
> fd becomes ready after the call to yield(), and we entered
> __alloc_pages() with state TASK_INTERRUPTIBLE, aren't we in exactly the
> same situation as described above?

No, you cannot restore the task state after having set it to TASK_RUNNING.

Just leave the state at TASK_RUNNING. The (silly) code which called the
page allocator in state TASK_[IN]TERRUPTIBLE will just go around its wait
loop an extra time and go back to sleep. This almost always works.

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