The patch titled Subject: hugetlbfs: call VM_BUG_ON_PAGE earlier in free_huge_page() has been added to the -mm tree. Its filename is hugetlbfs-call-vm_bug_on_page-earlier-in-free_huge_page.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/hugetlbfs-call-vm_bug_on_page-earlier-in-free_huge_page.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/hugetlbfs-call-vm_bug_on_page-earlier-in-free_huge_page.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yongkai Wu <nic.wuyk@xxxxxxxxx> Subject: 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@xxxxxxx Signed-off-by: Yongkai Wu <nic_w@xxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Acked-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Reviewed-by: William Kucharski <william.kucharski@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/hugetlb.c~hugetlbfs-call-vm_bug_on_page-earlier-in-free_huge_page +++ a/mm/hugetlb.c @@ -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); ClearPagePrivate(page); _ Patches currently in -mm which might be from nic.wuyk@xxxxxxxxx are hugetlbfs-call-vm_bug_on_page-earlier-in-free_huge_page.patch