Re: [RFC, 2.6] a simple FIFO implementation

From: Stelian Pop
Date: Fri Sep 17 2004 - 07:49:23 EST


On Fri, Sep 17, 2004 at 02:37:57PM +0200, Duncan Sands wrote:

> > + * Note that with only one concurrent reader and one concurrent
> > + * writer, you don't need extra locking to use these functions.
> ^^^^^ which functions? (ambiguous)

Well, the same comment is for two adjacent functions, so I don't
think it's so ambiguous. Or s/these/this/ if you prefer.

> And what does "extra locking" mean?

Some kind of locking, like the one the wrapper kfifo_get/kfifo_put
propose.

> > + len = min(len, fifo->size - fifo->in + fifo->out);
>
> After all, since you are reading both in and out here, some kind of
> locking is needed.

But the order in which in and out get modified guarantees that you
will still have a coherent content (provided the assignments are
atomic, which they are).

Stelian.
--
Stelian Pop <stelian@xxxxxxxxxx>
-
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/