lkml.org 
[lkml]   [2008]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ring_bufer: fix BUF_PAGE_SIZE

* Lai Jiangshan <laijs@cn.fujitsu.com> wrote:

>
> impact: make BUF_PAGE_SIZE changeable.
>
> Except allocating/freeing page and the code using PAGE_MASK,
> all code expect buffer_page's length is BUF_PAGE_SIZE.
>
> This patch make this behavior more concordant.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 668bbb5..0cf6caf 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -158,6 +158,10 @@ struct buffer_page {
> void *page; /* Actual data page */
> };
>
> +#define BUF_PAGE_ORDER 0
> +#define BUF_PAGE_SIZE (PAGE_SIZE << BUF_PAGE_ORDER)
> +#define BUF_PAGE_MASK (~(BUF_PAGE_SIZE - 1))
> +
> /*
> * Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing
> * this issue out.
> @@ -165,7 +169,7 @@ struct buffer_page {
> static inline void free_buffer_page(struct buffer_page *bpage)
> {
> if (bpage->page)
> - free_page((unsigned long)bpage->page);
> + free_pages((unsigned long)bpage->page, BUF_PAGE_ORDER);

hm, why? Non-order-0 allocations are pretty evil - why would we ever want
to do them?

Ingo


\
 
 \ /
  Last update: 2008-12-18 13:51    [W:0.375 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site