Skip to content

Commit 8ace22b

Browse files
Yongkai Wutorvalds
authored andcommitted
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. Link: http://lkml.kernel.org/r/1543491843-23438-1-git-send-email-nic_w@163.com Signed-off-by: Yongkai Wu <nic_w@163.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Mike Kravetz <mike.kravetz@oracle.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f5a222d commit 8ace22b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mm/hugetlb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,11 @@ void free_huge_page(struct page *page)
12481248
(struct hugepage_subpool *)page_private(page);
12491249
bool restore_reserve;
12501250

1251-
set_page_private(page, 0);
1252-
page->mapping = NULL;
12531251
VM_BUG_ON_PAGE(page_count(page), page);
12541252
VM_BUG_ON_PAGE(page_mapcount(page), page);
1253+
1254+
set_page_private(page, 0);
1255+
page->mapping = NULL;
12551256
restore_reserve = PagePrivate(page);
12561257
ClearPagePrivate(page);
12571258

0 commit comments

Comments
 (0)