Skip to content

Commit

Permalink
mm: verify compound order when freeing a page
Browse files Browse the repository at this point in the history
This allows us to catch the bug fixed in the previous patch (mm: free
compound page with correct order).

Here we also verify whether a page is tail page or not -- tail pages are
supposed to be freed along with their head, not by themselves.

Signed-off-by: Yu Zhao <[email protected]>
Reviewed-by: "Kirill A. Shutemov" <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Bob Liu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
yuzhaogoogle authored and torvalds committed Dec 11, 2014
1 parent d7be003 commit ab1f306
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
int i;
int bad = 0;

VM_BUG_ON_PAGE(PageTail(page), page);
VM_BUG_ON_PAGE(PageHead(page) && compound_order(page) != order, page);

trace_mm_page_free(page, order);
kmemcheck_free_shadow(page, order);

Expand Down

0 comments on commit ab1f306

Please sign in to comment.