lkml.org 
[lkml]   [2008]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] ring-buffer: read page interface
On Tue, 02 Dec 2008 15:34:07 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: Steven Rostedt <srostedt@redhat.com>
>
> Impact: new API to ring buffer
>
> This patch adds a new interface into the ring buffer that allows a
> page to be read from the ring buffer on a given CPU. For every page
> read, one must also be given to allow for a "swap" of the pages.
>
> rpage = ring_buffer_alloc_read_page(buffer);
> if (!rpage)
> goto err;
> ret = ring_buffer_read_page(buffer, &rpage, cpu, full);
> if (!ret)
> goto empty;
> process_page(rpage);
> ring_buffer_free_read_page(rpage);
>
> The caller of these functions must handle any waits that are
> needed to wait for new data. The ring_buffer_read_page will simply
> return 0 if there is no data, or if "full" is set and the writer
> is still on the current page.
>
> ...
>
> +static inline void *
> +__rb_data_page_index(struct buffer_data_page *page, unsigned index)
> +{
> + return page->data + index;
> +}

Many kernel developers will fall over stunned and confused when they
see a variable called `page' which does not have type `struct page *'.
This is a very strong kernel convention and this code tromps all over
it :(

How's about renaming all of these everywhere to `bpage' or whatever?

>
> ...
>
> + if (!local_read(&cpu_buffer->reader_page->page->commit))
>

Rusty (I think it was Rusty) has convincingly argued that local_t is
irredeemably busted. I forget the details?



\
 
 \ /
  Last update: 2008-12-02 22:41    [W:0.122 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site