]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
authorMuchun Song <songmuchun@bytedance.com>
Fri, 5 Feb 2021 02:32:13 +0000 (18:32 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Feb 2021 19:03:47 +0000 (11:03 -0800)
The page_huge_active() can be called from scan_movable_pages() which do
not hold a reference count to the HugeTLB page.  So when we call
page_huge_active() from scan_movable_pages(), the HugeTLB page can be
freed parallel.  Then we will trigger a BUG_ON which is in the
page_huge_active() when CONFIG_DEBUG_VM is enabled.  Just remove the
VM_BUG_ON_PAGE.

Link: https://lkml.kernel.org/r/20210115124942.46403-6-songmuchun@bytedance.com
Fixes: 7e1f049efb86 ("mm: hugetlb: cleanup using paeg_huge_active()")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c

index 90e03c3000c514592afa2ec7287ef71b8487ca26..d78111f0fa2cbf3936582eb9f7189fcda08e14e5 100644 (file)
@@ -1361,8 +1361,7 @@ struct hstate *size_to_hstate(unsigned long size)
  */
 bool page_huge_active(struct page *page)
 {
-       VM_BUG_ON_PAGE(!PageHuge(page), page);
-       return PageHead(page) && PagePrivate(&page[1]);
+       return PageHeadHuge(page) && PagePrivate(&page[1]);
 }
 
 /* never called for tail page */