MIPS: Hugetlbfs: Handle huge pages correctly in pmd_bad()
authorRalf Baechle <ralf@linux-mips.org>
Tue, 16 Oct 2012 23:01:12 +0000 (01:01 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 16 Oct 2012 23:01:12 +0000 (01:01 +0200)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/pgtable-64.h

index c26e182500799b7ba6cf97b2ef540f6feb82b6c8..f5b521d5a67d744e3f250c5a99e5023c77deaee0 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef _ASM_PGTABLE_64_H
 #define _ASM_PGTABLE_64_H
 
+#include <linux/compiler.h>
 #include <linux/linkage.h>
 
 #include <asm/addrspace.h>
@@ -172,7 +173,19 @@ static inline int pmd_none(pmd_t pmd)
        return pmd_val(pmd) == (unsigned long) invalid_pte_table;
 }
 
-#define pmd_bad(pmd)           (pmd_val(pmd) & ~PAGE_MASK)
+static inline int pmd_bad(pmd_t pmd)
+{
+#ifdef CONFIG_HUGETLB_PAGE
+       /* pmd_huge(pmd) but inline */
+       if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
+               return 0;
+#endif
+
+       if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
+               return 1;
+
+       return 0;
+}
 
 static inline int pmd_present(pmd_t pmd)
 {