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

From: Chris Mason (mason@suse.com)
Date: Tue Jun 10 2003 - 19:54:00 EST


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

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



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:26 EST