Re: [PATCH v10 Golden] Unified trace buffer

From: Steven Rostedt
Date: Tue Sep 30 2008 - 13:57:40 EST



On Tue, 30 Sep 2008, Peter Zijlstra wrote:
>
> The problem with storing the page link information inside the page is
> that it doesnt transfer to another address space, so if you do indeed
> mmap these pages, then the link information is bogus.
>
> Of course, in such a situation you could ignore these headers, but
> somehow that doesn't sound too apealing.


No that's not what I'm proposing. I'm proposing to allocate a page_header
structure for every page we alloc, and make a link list of them.
In other words:


struct ring_buffer_per_cpu {
[...]
struct list_head pages;
[...]
};

struct buffer_page {
[...];
void *page;
struct list_head list;
[...];
};

In ring_buffer_allocate_cpu:

struct buffer_page *bpage;
struct unsigned long addr;

[...]

for every page() {
bpage = kzalloc(sizeof(*bpage), GFP_KERNEL);
addr = get_free_page();
bpage->page = (void *)addr;
list_add(&bpage->list, &cpu_buffer->pages);
}


Obviously need to add the error checking, but you get the idea. Here I do
not need to change any of the later logic, because we are still dealing
with the buffer_page. I only need to update way to index the page which is
already encapsulated in its own function.

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