Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Hugetlbfs: Handle huge pages correctly in pmd_bad()

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

+14 -1
+14 -1
arch/mips/include/asm/pgtable-64.h
··· 9 9 #ifndef _ASM_PGTABLE_64_H 10 10 #define _ASM_PGTABLE_64_H 11 11 12 + #include <linux/compiler.h> 12 13 #include <linux/linkage.h> 13 14 14 15 #include <asm/addrspace.h> ··· 173 172 return pmd_val(pmd) == (unsigned long) invalid_pte_table; 174 173 } 175 174 176 - #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) 175 + static inline int pmd_bad(pmd_t pmd) 176 + { 177 + #ifdef CONFIG_HUGETLB_PAGE 178 + /* pmd_huge(pmd) but inline */ 179 + if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) 180 + return 0; 181 + #endif 182 + 183 + if (unlikely(pmd_val(pmd) & ~PAGE_MASK)) 184 + return 1; 185 + 186 + return 0; 187 + } 177 188 178 189 static inline int pmd_present(pmd_t pmd) 179 190 {