Re: [PATCH 1/2] misc: add CARMA DATA-FPGA Access Driver

From: Dmitry Torokhov
Date: Tue Feb 08 2011 - 14:33:37 EST


On Tue, Feb 08, 2011 at 11:11:44AM -0800, Ira W. Snyder wrote:
> On Tue, Feb 08, 2011 at 09:50:29AM -0800, Dmitry Torokhov wrote:
> > On Tue, Feb 08, 2011 at 09:20:46AM -0800, Ira W. Snyder wrote:
> >
> > > Go back and re-think my loop. This is a
> > > common idiom straight of out LDD3 pages 153-154.
> > >
> > > You should note that it is only possible to exit the loop with the lock
> > > held AND !list_empty(used). The lock protects the used list, and
> > > therefore, there must be a buffer on the list.
> >
> > No, because you are woken up while not holding the lock so another
> > reader is free to take it off the list.
> >
>
> Correct. But then I go around the loop and check list_empty() again
> before exiting the loop. The list MUST NOT be empty before the loop will
> terminate.

Yes, you are right, I competely missed the fact that we'd loop around
and check the condition again. I'll go grab another coffee now.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/