Re: [PATCH 3/3] ring-buffer: make cpu buffer entries counteratomic

From: Steven Rostedt
Date: Thu Apr 30 2009 - 23:28:19 EST





On Thu, 30 Apr 2009, Andrew Morton wrote:

> On Thu, 30 Apr 2009 22:22:13 -0400 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > @@ -405,7 +405,7 @@ struct ring_buffer_per_cpu {
> > unsigned long nmi_dropped;
> > unsigned long commit_overrun;
> > unsigned long overrun;
> > - unsigned long entries;
> > + atomic_t entries;
>
> This switches `entries' from unsigned-64-bit to signed-32-bit.

Good point. Although I doubt we will have more that 2billion entries in
one cpu buffer. But it can happen. I'll change that to 64 bit atomic.


>
> The signedness thing is just an unfortunate thing with atomic_t and probably
> doesn't matter.
>
> The change in size might or might not be a bug - that's for the person
> who didn't document the data structure to work out ;)
>
>
>
>
> /*
> * head_page == tail_page && head == tail then buffer is empty.
> */
> struct ring_buffer_per_cpu {
>
> the comment refers to vaporfields?
>

Ug, the head_page and tail_page are in this struct. But the "head" and
"tail" are with in the "head_page" and "tail_page" respectively.

-- Steve



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