In mm/vmalloc.c, make usage of guard pages dependant on CONFIG_DEBUG_PAGEALLOC. Signed-off-by: Glauber Costa Reworked so the guard size logic remains inside the allocator. Signed-off-by: Nick Piggin --- mm/vmalloc.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) Index: linux-2.6/mm/vmalloc.c =================================================================== --- linux-2.6.orig/mm/vmalloc.c +++ linux-2.6/mm/vmalloc.c @@ -29,6 +29,16 @@ #include #include +/* + * Add a guard page between each kernel virtual address allocation if + * DEBUG_PAGEALLOC is turned on (could be a separate config option, but + * no big deal). + */ +#ifdef CONFIG_DEBUG_PAGEALLOC +#define GUARD_SIZE PAGE_SIZE +#else +#define GUARD_SIZE 0 +#endif /*** Page table manipulation functions ***/ @@ -364,7 +374,7 @@ retry: } while (addr + size > first->va_start && addr + size <= vend) { - addr = ALIGN(first->va_end + PAGE_SIZE, align); + addr = ALIGN(first->va_end + GUARD_SIZE, align); n = rb_next(&first->rb_node); if (n) -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org