Re: [PATCH] build fix for generic debug pagealloc

From: Andrew Morton
Date: Thu Apr 02 2009 - 12:54:55 EST


On Fri, 3 Apr 2009 01:31:52 +0900 Akinobu Mita <akinobu.mita@xxxxxxxxx> wrote:

> > mm/debug-pagealloc.c: In function 'set_page_poison':
> > mm/debug-pagealloc.c:8: error: 'struct page' has no member named 'debug_flags'
> > mm/debug-pagealloc.c: In function 'clear_page_poison':
> > mm/debug-pagealloc.c:13: error: 'struct page' has no member named 'debug_flags'
> > mm/debug-pagealloc.c: In function 'page_poison':
> > mm/debug-pagealloc.c:18: error: 'struct page' has no member named 'debug_flags'
> > mm/debug-pagealloc.c: At top level:
> > mm/debug-pagealloc.c:120: error: redefinition of 'kernel_map_pages'
> > include/linux/mm.h:1278: error: previous definition of
> > 'kernel_map_pages' was here
> > mm/debug-pagealloc.c: In function 'kernel_map_pages':
> > mm/debug-pagealloc.c:122: error: 'debug_pagealloc_enabled' undeclared
> > (first use in this function)
>
> This patch fixes build failure with generic debug pagealloc:
>
> - debug_flags should be in struct page
> - define DEBUG_PAGEALLOC config option for all architectures
>
> ...
>
> bool "Debug access to per_cpu maps"
> depends on DEBUG_KERNEL
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index ddadb4d..0e80e26 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -95,6 +95,9 @@ struct page {
> void *virtual; /* Kernel virtual address (NULL if
> not kmapped, ie. highmem) */
> #endif /* WANT_PAGE_VIRTUAL */
> +#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
> + unsigned long debug_flags; /* Use atomic bitops on this */
> +#endif
> };
>
> /*
> @@ -175,9 +178,6 @@ struct vm_area_struct {
> #ifdef CONFIG_NUMA
> struct mempolicy *vm_policy; /* NUMA policy for the VMA */
> #endif
> -#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
> - unsigned long debug_flags; /* Use atomic bitops on this */
> -#endif
> };

dammit.

> struct core_thread {
> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
> index c8d62d4..bb01e29 100644
> --- a/mm/Kconfig.debug
> +++ b/mm/Kconfig.debug
> @@ -1,3 +1,12 @@
> +config DEBUG_PAGEALLOC
> + bool "Debug page memory allocations"
> + depends on DEBUG_KERNEL && ARCH_SUPPORTS_DEBUG_PAGEALLOC
> + depends on !HIBERNATION || !PPC && !SPARC
> + ---help---
> + Unmap pages from the kernel linear mapping after free_pages().
> + This results in a large slowdown, but helps to find certain types
> + of memory corruptions.
> +

I guess this is why it wasn't discovered in my compile testing. It's
quite regrettable that `make allmodconfig' didn't enable the feature.
That's what allmodconfig is for.
--
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/