Skip to content

Commit d062a79

Browse files
sunnanyongpalmer-dabbelt
authored andcommitted
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 <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent fba88ed commit d062a79

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ config RISCV
7676
select HAVE_ARCH_SECCOMP_FILTER
7777
select HAVE_ARCH_TRACEHOOK
7878
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
79+
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
7980
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
8081
select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
8182
select HAVE_ASM_MODVERSIONS

arch/riscv/include/asm/pgtable.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,11 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
649649
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
650650
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
651651

652+
#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
653+
#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) })
654+
#define __swp_entry_to_pmd(swp) __pmd((swp).val)
655+
#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
656+
652657
/*
653658
* In the RV64 Linux scheme, we give the user half of the virtual-address space
654659
* and give the kernel the other (upper) half.

0 commit comments

Comments
 (0)