Re: [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6)

Chris Mason
2003-06-11T00:41:14Z

On Tue, 2003-06-10 at 20:33, 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:
>

clear_queue_full has a wmb() in my patch, and queue_full has a rmb(), I
thought that covered these cases? I'd rather remove those though, since
the spot you point out is the only place done outside the
io_request_lock.

> 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 don't think we need the extra wake_up (this is in __get_request_wait,
right?), since it gets done by get_request_wait_wakeup()

> I'm also unsure what the "waited" logic does, it doesn't seem necessary.

Once a process waits once, they are allowed to ignore the q->full flag.
This way existing waiters can make progress even when q->full is set.
Without the waited check, q->full will never get cleared because the
last writer wouldn't proceed until the last writer was gone. I had to
make __get_request for the same reason.

-chris