Re: [RFC, 2.6] a simple FIFO implementation

From: Stelian Pop
Date: Fri Sep 17 2004 - 08:09:24 EST


On Fri, Sep 17, 2004 at 03:00:35PM +0200, Duncan Sands wrote:

> > 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).
>
> Hi Stelian, what is to stop the compiler putting, say, "in" in a register
> for the process calling __kfifo_get, so that it only sees a constant
> value. Then after a while that process will think there is nothing
> to get even though another process is shoving stuff into the fifo and
> modifying "in".

This can happen all right, but the buffer (or the indices) will not
get corrupt (this is what I call coherent). Its just like the __kfifo_get()
was executed entirely before the __kfifo_put().

There is no problem here.

>
> By the way, the comment for __kfifo_get has a typo:
>
> + * kfifo_get - gets some data from the FIFO, no locking version
> ^^^^^^^^^ should be __kfifo_get

Same for kfifo_len, too much cut & paste here. Thanks.

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/