riscv: mm: make pmd_bad() check leaf condition
authorNanyong Sun <sunnanyong@huawei.com>
Fri, 30 Apr 2021 08:28:48 +0000 (16:28 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 22 May 2021 17:19:38 +0000 (10:19 -0700)
In the definition in Documentation/vm/arch_pgtable_helpers.rst,
pmd_bad() means test a non-table mapped PMD, so it should also
return true when it is a leaf page.

Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/pgtable.h

index dbced7d..b06eb83 100644 (file)
@@ -184,7 +184,7 @@ static inline int pmd_none(pmd_t pmd)
 
 static inline int pmd_bad(pmd_t pmd)
 {
-       return !pmd_present(pmd);
+       return !pmd_present(pmd) || (pmd_val(pmd) & _PAGE_LEAF);
 }
 
 #define pmd_leaf       pmd_leaf