mm: hugetlbfs: Add some VM_BUG_ON()s to catch non-hugetlbfs pages
authorDave Hansen <[email protected]>
Tue, 21 Jan 2014 23:48:48 +0000 (15:48 -0800)
committerLinus Torvalds <[email protected]>
Wed, 22 Jan 2014 00:19:43 +0000 (16:19 -0800)
Dave Jiang reported that he was seeing oopses when running NUMA systems
and default_hugepagesz=1G.  I traced the issue down to
migrate_page_copy() trying to use the same code for hugetlb pages and
transparent hugepages.  It should not have been trying to pass thp pages
in there.

So, add some VM_BUG_ON()s for the next hapless VM developer that tries
the same thing.

Signed-off-by: Dave Hansen <[email protected]>
Reviewed-by: Naoya Horiguchi <[email protected]>
Tested-by: Dave Jiang <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/hugetlb.h

index bd7e987522221f42b7042cc242abc8ca31a72996..251233c1494df793ae7d9d90e4bc5ed5e794ab28 100644 (file)
@@ -360,6 +360,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
 
 static inline struct hstate *page_hstate(struct page *page)
 {
+       VM_BUG_ON(!PageHuge(page));
        return size_to_hstate(PAGE_SIZE << compound_order(page));
 }