Skip to content

Commit 62df587

Browse files
Yicong Yangctmarinas
authored andcommitted
arm64: Enable ARCH_HAS_NONLEAF_PMD_YOUNG
With the support of FEAT_HAFT, the NONLEAF_PMD_YOUNG can be enabled on arm64 since the hardware is capable of updating the AF flag for PMD table descriptor. Since the AF bit of the table descriptor shares the same bit position in block descriptors, we only need to implement arch_has_hw_nonleaf_pmd_young() and select related configs. The related pmd_young test/update operations keeps the same with and already implemented for transparent page support. Currently ARCH_HAS_NONLEAF_PMD_YOUNG is used to improve the efficiency of lru-gen aging. Signed-off-by: Yicong Yang <yangyicong@hisilicon.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20241102104235.62560-5-yangyicong@huawei.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent efe7254 commit 62df587

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ config ARM64
3838
select ARCH_HAS_MEM_ENCRYPT
3939
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
4040
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
41+
select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAFT
4142
select ARCH_HAS_PTE_DEVMAP
4243
select ARCH_HAS_PTE_SPECIAL
4344
select ARCH_HAS_HW_PTE_YOUNG

arch/arm64/include/asm/pgtable.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,15 +1259,15 @@ static inline int __ptep_clear_flush_young(struct vm_area_struct *vma,
12591259
return young;
12601260
}
12611261

1262-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1262+
#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG)
12631263
#define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
12641264
static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
12651265
unsigned long address,
12661266
pmd_t *pmdp)
12671267
{
12681268
return __ptep_test_and_clear_young(vma, address, (pte_t *)pmdp);
12691269
}
1270-
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1270+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG */
12711271

12721272
static inline pte_t __ptep_get_and_clear(struct mm_struct *mm,
12731273
unsigned long address, pte_t *ptep)
@@ -1502,6 +1502,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf,
15021502
*/
15031503
#define arch_has_hw_pte_young cpu_has_hw_af
15041504

1505+
#ifdef CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG
1506+
#define arch_has_hw_nonleaf_pmd_young system_supports_haft
1507+
#endif
1508+
15051509
/*
15061510
* Experimentally, it's cheap to set the access flag in hardware and we
15071511
* benefit from prefaulting mappings as 'old' to start with.

0 commit comments

Comments
 (0)