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