aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuacai Chen <[email protected]>2018-11-15 15:53:54 +0800
committerPaul Burton <[email protected]>2018-11-20 21:05:39 -0800
commit92aa0718c9fa5160ad2f0e7b5bffb52f1ea1e51a (patch)
tree4ca74ae9d482174be55b55941d75983cff89211b
parentbb53fdf395eed103f85061bfff3b116cee123895 (diff)
MIPS: Ensure pmd_present() returns false after pmd_mknotpresent()
This patch is borrowed from ARM64 to ensure pmd_present() returns false after pmd_mknotpresent(). This is needed for THP. References: 5bb1cc0ff9a6 ("arm64: Ensure pmd_present() returns false after pmd_mknotpresent()") Reviewed-by: James Hogan <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Paul Burton <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/21135/ Cc: Ralf Baechle <[email protected]> Cc: James Hogan <[email protected]> Cc: Steven J . Hill <[email protected]> Cc: [email protected] Cc: Fuxin Zhang <[email protected]> Cc: Zhangjin Wu <[email protected]> Cc: <[email protected]> # 3.8+
-rw-r--r--arch/mips/include/asm/pgtable-64.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index 0036ea0c7173..93a9dce31f25 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -265,6 +265,11 @@ static inline int pmd_bad(pmd_t pmd)
static inline int pmd_present(pmd_t pmd)
{
+#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
+ if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
+ return pmd_val(pmd) & _PAGE_PRESENT;
+#endif
+
return pmd_val(pmd) != (unsigned long) invalid_pte_table;
}