From: Ralf Baechle Date: Tue, 16 Oct 2012 23:01:12 +0000 (+0200) Subject: MIPS: Hugetlbfs: Handle huge pages correctly in pmd_bad() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=344afa6550a66eb4b7103cf1b65fca6f38d380d8;p=openwrt%2Fstaging%2Fblogic.git MIPS: Hugetlbfs: Handle huge pages correctly in pmd_bad() Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index c26e18250079..f5b521d5a67d 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -9,6 +9,7 @@ #ifndef _ASM_PGTABLE_64_H #define _ASM_PGTABLE_64_H +#include #include #include @@ -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) {