Re: [PATCH] io stalls

Nick Piggin
2003-06-11T00:35:07Z

Andrea Arcangeli wrote:

>On Mon, Jun 09, 2003 at 05:39:23PM -0400, Chris Mason wrote:
>
>>+ if (!waitqueue_active(&q->wait_for_requests[rw]))
>>+ clear_queue_full(q, rw);
>>
>
>you've an smp race above, the smp safe implementation is this:
>
> if (!waitqueue_active(&q->wait_for_requests[rw])) {
> clear_queue_full(q, rw);
> mb();
> if (unlikely(waitqueue_active(&q->wait_for_requests[rw])))
> wake_up(&q->wait_for_requests[rw]);
> }
>
>I'm also unsure what the "waited" logic does, it doesn't seem necessary.
>

When a task is woken up, it is quite likely that the
queue is still marked full.