aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/pgtable.h
diff options
context:
space:
mode:
authorNanyong Sun <sunnanyong@huawei.com>2021-11-23 22:06:38 +0800
committerPalmer Dabbelt <palmer@rivosinc.com>2022-01-07 15:54:28 -0800
commitd062a79b7c80064d5b40bcd78009fe30adde5cea (patch)
treee97e03b4650858f8a11e2be9846215986958e657 /arch/riscv/include/asm/pgtable.h
parentriscv/mm: Adjust PAGE_PROT_NONE to comply with THP semantics (diff)
downloadlinux-dev-d062a79b7c80064d5b40bcd78009fe30adde5cea.tar.xz
linux-dev-d062a79b7c80064d5b40bcd78009fe30adde5cea.zip
riscv/mm: Enable THP migration
Add two THP helpers required to create PMD migration swap entries, and enable THP migration via ARCH_ENABLE_THP_MIGRATION. This can reduce time of THP migration without splitting and guarantee the migrated pages are still contiguous. Signed-off-by: Nanyong Sun <sunnanyong@huawei.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/asm/pgtable.h')
-rw-r--r--arch/riscv/include/asm/pgtable.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 34230c277358..67f687aee673 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -649,6 +649,11 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
+#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
+#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) })
+#define __swp_entry_to_pmd(swp) __pmd((swp).val)
+#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
+
/*
* In the RV64 Linux scheme, we give the user half of the virtual-address space
* and give the kernel the other (upper) half.