lkml.org 
[lkml]   [2008]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] VM: Annotate pagealloc
Hi Steve,

On Sat, Aug 30, 2008 at 2:16 AM, Steve VanDeBogart
<vandebo-lkml@nerdbox.net> wrote:
> Valgrind annotations for valgrind: memory is addressable once it's been
> alloced, and unaddressable when it is freed again. Can't use malloc-like
> and free-like because valgrind considers a malloc-like chunk indivisible.
>
> Signed-off-by: Steve VanDeBogart <vandebo-lkml@nerdbox.net>
> ---
>
> Index: linux-2.6.27-rc5/mm/page_alloc.c
> ===================================================================
> --- linux-2.6.27-rc5.orig/mm/page_alloc.c 2008-08-29
> 14:24:27.000000000 -0700
> +++ linux-2.6.27-rc5/mm/page_alloc.c 2008-08-29 14:24:37.000000000 -0700
> @@ -46,6 +46,7 @@
> #include <linux/page-isolation.h>
> #include <linux/memcontrol.h>
> #include <linux/debugobjects.h>
> +#include <linux/memcheck.h>
>
> #include <asm/tlbflush.h>
> #include <asm/div64.h>
> @@ -1080,6 +1081,7 @@
> if (!page)
> goto failed;
> }
> + VALGRIND_MAKE_MEM_UNDEFINED(page_address(page), PAGE_SIZE << order);

No SHOUTING macros please, and I think you should just pass page and
order here and do the calculation elsewhere.

>
> __count_zone_vm_events(PGALLOC, zone, 1 << order);
> zone_statistics(preferred_zone, zone);
> @@ -1679,6 +1681,8 @@
> void __free_pages(struct page *page, unsigned int order)
> {
> if (put_page_testzero(page)) {
> + VALGRIND_MAKE_MEM_NOACCESS(page_address(page),
> + PAGE_SIZE << order);

Same here.

> if (order == 0)
> free_hot_page(page);
> else

Other than that, looks good to me.


\
 
 \ /
  Last update: 2008-08-30 13:01    [W:0.125 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site