On Thu, 8 Jan 2015 16:10:04 +0200 (EET) "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> wrote: > Something like this? > > >From 5fd481c1c521112e9cea407f5a2644c9f93d0e14 Mon Sep 17 00:00:00 2001 > From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> > Date: Thu, 8 Jan 2015 15:59:23 +0200 > Subject: [PATCH] mm: more checks on free_pages_prepare() for tail pages > > Apart form being dead, destroy_compound_page() did some potentially > useful checks. Let's re-introduce them in free_pages_prepare(), where > they can be acctually triggered. > > compound_order() assert is already in free_pages_prepare(). We have few > checks for tail pages left. > I'm thinking we avoid the overhead unless CONFIG_DEBUG_VM? From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-more-checks-on-free_pages_prepare-for-tail-pages-fix Make it conditional on CONFIG_DEBUG_VM, make free_tail_pages_check() return void. Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff -puN mm/page_alloc.c~mm-more-checks-on-free_pages_prepare-for-tail-pages-fix mm/page_alloc.c --- a/mm/page_alloc.c~mm-more-checks-on-free_pages_prepare-for-tail-pages-fix +++ a/mm/page_alloc.c @@ -764,20 +764,26 @@ static void free_one_page(struct zone *z spin_unlock(&zone->lock); } -static int free_tail_pages_check(struct page *head_page, struct page *page) +#ifdef CONFIG_DEBUG_VM +static void free_tail_pages_check(struct page *head_page, struct page *page) { if (!IS_ENABLED(CONFIG_DEBUG_VM)) - return 0; + return; if (unlikely(!PageTail(page))) { bad_page(page, "PageTail not set", 0); - return 1; + return; } if (unlikely(page->first_page != head_page)) { bad_page(page, "first_page not consistent", 0); - return 1; + return; } - return 0; } +#else +static inline void free_tail_pages_check(struct page *head_page, + struct page *page) +{ +} +#endif static bool free_pages_prepare(struct page *page, unsigned int order) { _ -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>