Commit 8ace22bc authored by Yongkai Wu's avatar Yongkai Wu Committed by Linus Torvalds
Browse files

hugetlbfs: call VM_BUG_ON_PAGE earlier in free_huge_page()

A stack trace was triggered by VM_BUG_ON_PAGE(page_mapcount(page), page)
in free_huge_page().  Unfortunately, the page->mapping field was set to
NULL before this test.  This made it more difficult to determine the
root cause of the problem.

Move the VM_BUG_ON_PAGE tests earlier in the function so that if they do
trigger more information is present in the page struct.


Signed-off-by: default avatarYongkai Wu <>
Acked-by: default avatarMichal Hocko <>
Acked-by: default avatarMike Kravetz <>
Reviewed-by: default avatarWilliam Kucharski <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f5a222dc
......@@ -1248,10 +1248,11 @@ void free_huge_page(struct page *page)
(struct hugepage_subpool *)page_private(page);
bool restore_reserve;
set_page_private(page, 0);
page->mapping = NULL;
VM_BUG_ON_PAGE(page_count(page), page);
VM_BUG_ON_PAGE(page_mapcount(page), page);
set_page_private(page, 0);
page->mapping = NULL;
restore_reserve = PagePrivate(page);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment