Skip to content

Commit 53fa117

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/mm: Enable THP migration
In certain page migration situations, a THP page can be migrated without being split into it's constituent subpages. This saves time required to split a THP and put it back together when required. But it also saves an wider address range translation covered by a single TLB entry, reducing future page fault costs. A previous patch changed platform THP helpers per generic memory semantics, clearing the path for THP migration support. This adds two more THP helpers required to create PMD migration swap entries. Now enable THP migration via ARCH_ENABLE_THP_MIGRATION. Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Suzuki Poulose <suzuki.poulose@arm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Link: https://lore.kernel.org/r/1599627183-14453-3-git-send-email-anshuman.khandual@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent b65399f commit 53fa117

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

arch/arm64/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,10 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION
18761876
def_bool y
18771877
depends on HUGETLB_PAGE && MIGRATION
18781878

1879+
config ARCH_ENABLE_THP_MIGRATION
1880+
def_bool y
1881+
depends on TRANSPARENT_HUGEPAGE
1882+
18791883
menu "Power management options"
18801884

18811885
source "kernel/power/Kconfig"

arch/arm64/include/asm/pgtable.h

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

878+
#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
879+
#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) })
880+
#define __swp_entry_to_pmd(swp) __pmd((swp).val)
881+
#endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
882+
878883
/*
879884
* Ensure that there are not more swap files than can be encoded in the kernel
880885
* PTEs.

0 commit comments

Comments
 (0)