mm/mglru: Kconfig cleanup
Subsystems (15)
v3 cover mm/mglru: Kconfig cleanup
This series is the result of the following discussion:
https://lore.kernel.org/[email protected]/
It mainly avoids building the code that walks page tables on CPUs that use it, i.e., those don't support hardware accessed bit. Specifically, it introduces a new Kconfig to guard some of functions added by commit bd74fdaea146 ("mm: multi-gen LRU: support page table walks") on CPUs like POWER9, on which the series was tested.
Kinsey Ho (4):
mm/mglru: add CONFIG_ARCH_HAS_HW_PTE_YOUNG
mm/mglru: add CONFIG_LRU_GEN_WALKS_MMU
mm/mglru: remove CONFIG_MEMCG
mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE
arch/Kconfig | 8 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 - include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 16 +- include/linux/mmzone.h | 28 +--- include/linux/pgtable.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 271 ++++++++++++++++++--------------- 11 files changed, 174 insertions(+), 167 deletions(-)
Signature · 1 line
2.43.0.472.g3155946c3a-goog
PATCH 1/4 mm/mglru: add CONFIG_ARCH_HAS_HW_PTE_YOUNG
Some architectures are able to set the accessed bit in PTEs when PTEs are used as part of linear address translations.
Add CONFIG_ARCH_HAS_HW_PTE_YOUNG for such architectures to be able to override arch_has_hw_pte_young().
--- arch/Kconfig | 8 ++++++++ arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 ------ include/linux/pgtable.h | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-)
arch/Kconfig +8 -0
@@ -1470,6 +1470,14 @@ config DYNAMIC_SIGFRAME config HAVE_ARCH_NODE_DEV_GROUP bool +config ARCH_HAS_HW_PTE_YOUNG + bool + help + Architectures that select this option are capable of setting the + accessed bit in PTE entries when using them as part of linear address + translations. Architectures that require runtime check should select + this option and override arch_has_hw_pte_young(). + config ARCH_HAS_NONLEAF_PMD_YOUNG bool help
arch/arm64/Kconfig +1 -0
@@ -36,6 +36,7 @@ config ARM64 select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_DEVMAP select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_HW_PTE_YOUNG select ARCH_HAS_SETUP_DMA_OPS select ARCH_HAS_SET_DIRECT_MAP select ARCH_HAS_SET_MEMORY
arch/x86/Kconfig +1 -0
@@ -88,6 +88,7 @@ config X86 select ARCH_HAS_PMEM_API if X86_64 select ARCH_HAS_PTE_DEVMAP if X86_64 select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_HW_PTE_YOUNG select ARCH_HAS_NONLEAF_PMD_YOUNG if PGTABLE_LEVELS > 2 select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64 select ARCH_HAS_COPY_MC if X86_64
arch/x86/include/asm/pgtable.h +0 -6
@@ -1679,12 +1679,6 @@ static inline bool arch_has_pfn_modify_check(void)return boot_cpu_has_bug (X86_BUG_L1TF ); } -#define arch_has_hw_pte_young arch_has_hw_pte_young -static inline bool arch_has_hw_pte_young (void ) -{ -return true; -} -#define arch_check_zapped_pte arch_check_zapped_ptevoid arch_check_zapped_pte (struct vm_area_struct *vma,pte_t pte);
include/linux/pgtable.h +1 -1
@@ -375,7 +375,7 @@ static inline bool arch_has_hw_nonleaf_pmd_young(void)*/ static inline bool arch_has_hw_pte_young (void ) { -return false; +return IS_ENABLED (CONFIG_ARCH_HAS_HW_PTE_YOUNG ); }#endif
Signature · 1 line
2.43.0.472.g3155946c3a-goog
PATCH 2/4 mm/mglru: add CONFIG_LRU_GEN_WALKS_MMU
In reply to Kinsey HoAdd CONFIG_LRU_GEN_WALKS_MMU such that if disabled, the code that walks page tables to promote pages into the youngest generation will not be built.
Also improves code readability by adding two helper functions get_mm_state() and get_next_mm().
--- include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 12 ++- include/linux/mmzone.h | 2 + kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 192 ++++++++++++++++++++++++------------- 6 files changed, 139 insertions(+), 75 deletions(-)
include/linux/memcontrol.h +1 -1
@@ -330,7 +330,7 @@ struct mem_cgroup {struct deferred_split deferred_split_queue;#endif -#ifdef CONFIG_LRU_GEN +#ifdef CONFIG_LRU_GEN_WALKS_MMU /* per-memcg mm_struct list */ struct lru_gen_mm_list mm_list;#endif
include/linux/mm_types.h +8 -4
@@ -958,7 +958,7 @@ struct mm_struct {*/ unsigned long ksm_zero_pages;#endif /* CONFIG_KSM */ -#ifdef CONFIG_LRU_GEN +#ifdef CONFIG_LRU_GEN_WALKS_MMU struct { /* this mm_struct is on lru_gen_mm_list */ struct list_head list;
@@ -973,7 +973,7 @@ struct mm_struct {struct mem_cgroup *memcg; #endif } lru_gen; -#endif /* CONFIG_LRU_GEN */ +#endif /* CONFIG_LRU_GEN_WALKS_MMU */ } __randomize_layout;/*
@@ -1011,6 +1011,10 @@ struct lru_gen_mm_list { spinlock_t lock; }; +#endif /* CONFIG_LRU_GEN */ + +#ifdef CONFIG_LRU_GEN_WALKS_MMU +void lru_gen_add_mm (struct mm_struct *mm);void lru_gen_del_mm (struct mm_struct *mm);#ifdef CONFIG_MEMCG
@@ -1036,7 +1040,7 @@ static inline void lru_gen_use_mm(struct mm_struct *mm) WRITE_ONCE(mm->lru_gen.bitmap, -1); } -#else /* !CONFIG_LRU_GEN */ +#else /* !CONFIG_LRU_GEN_WALKS_MMU */ static inline void lru_gen_add_mm (struct mm_struct *mm) {
@@ -1060,7 +1064,7 @@ static inline void lru_gen_use_mm(struct mm_struct *mm) { } -#endif /* CONFIG_LRU_GEN */ +#endif /* CONFIG_LRU_GEN_WALKS_MMU */ struct vma_iterator {struct ma_state mas;
include/linux/mmzone.h +2 -0
@@ -640,9 +640,11 @@ struct lruvec {#ifdef CONFIG_LRU_GEN /* evictable pages divided into generations */ struct lru_gen_folio lrugen; +#ifdef CONFIG_LRU_GEN_WALKS_MMU /* to concurrently iterate lru_gen_mm_list */ struct lru_gen_mm_state mm_state;#endif +#endif /* CONFIG_LRU_GEN */ #ifdef CONFIG_MEMCG struct pglist_data *pgdat;#endif
kernel/fork.c +1 -1
@@ -2946,7 +2946,7 @@ pid_t kernel_clone(struct kernel_clone_args *args)get_task_struct (p); } -if (IS_ENABLED (CONFIG_LRU_GEN ) && !(clone_flags &CLONE_VM )) { +if (IS_ENABLED (CONFIG_LRU_GEN_WALKS_MMU ) && !(clone_flags &CLONE_VM )) {/* lock the task to synchronize with memcg migration */ task_lock (p);lru_gen_add_mm (p->mm);
mm/Kconfig +4 -0
@@ -1274,6 +1274,10 @@ config LRU_GEN_STATS from evicted generations for debugging purpose. This option has a per-memcg and per-node memory overhead. + +config LRU_GEN_WALKS_MMU + def_bool y + depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG # } config ARCH_SUPPORTS_PER_VMA_LOCK
mm/vmscan.c +123 -69
433 lines not on this page · raw message
Signature · 1 line
2.43.0.472.g3155946c3a-goog
PATCH 3/4 mm/mglru: remove CONFIG_MEMCG
In reply to Kinsey HoRemove CONFIG_MEMCG in a refactoring to improve code readability at the cost of a few bytes in struct lru_gen_folio per node when CONFIG_MEMCG=n.
--- include/linux/mm_types.h | 4 --- include/linux/mmzone.h | 26 ++-------------- mm/vmscan.c | 67 +++++++++++++--------------------------- 3 files changed, 23 insertions(+), 74 deletions(-)
include/linux/mm_types.h +0 -4
@@ -1017,9 +1017,7 @@ struct lru_gen_mm_list {void lru_gen_add_mm (struct mm_struct *mm);void lru_gen_del_mm (struct mm_struct *mm); -#ifdef CONFIG_MEMCG void lru_gen_migrate_mm (struct mm_struct *mm); -#endif static inline void lru_gen_init_mm (struct mm_struct *mm) {
@@ -1050,11 +1048,9 @@ static inline void lru_gen_del_mm(struct mm_struct *mm) { } -#ifdef CONFIG_MEMCG static inline void lru_gen_migrate_mm (struct mm_struct *mm) { } -#endif static inline void lru_gen_init_mm (struct mm_struct *mm) {
include/linux/mmzone.h +2 -24
@@ -440,14 +440,12 @@ struct lru_gen_folio {atomic_long_t refaulted[NR_HIST_GENS ][ANON_AND_FILE ][MAX_NR_TIERS ];/* whether the multi-gen LRU is enabled */ bool enabled; -#ifdef CONFIG_MEMCG /* the memcg generation this lru_gen_folio belongs to */ u8 gen;/* the list segment this lru_gen_folio belongs to */ u8 seg;/* per-node lru_gen_folio list for global reclaim */ struct hlist_nulls_node list; -#endif };enum {
@@ -493,11 +491,6 @@ struct lru_gen_mm_walk {bool force_scan; }; -void lru_gen_init_lruvec (struct lruvec *lruvec); -void lru_gen_look_around (struct page_vma_mapped_walk *pvmw); - -#ifdef CONFIG_MEMCG -/* * For each node, memcgs are divided into two generations: the old and the * young. For each generation, memcgs are randomly sharded into multiple bins
@@ -555,6 +548,8 @@ struct lru_gen_memcg { };void lru_gen_init_pgdat (struct pglist_data *pgdat); +void lru_gen_init_lruvec (struct lruvec *lruvec); +void lru_gen_look_around (struct page_vma_mapped_walk *pvmw);void lru_gen_init_memcg (struct mem_cgroup *memcg);void lru_gen_exit_memcg (struct mem_cgroup *memcg);
@@ -563,19 +558,6 @@ void lru_gen_offline_memcg(struct mem_cgroup *memcg);void lru_gen_release_memcg (struct mem_cgroup *memcg);void lru_gen_soft_reclaim (struct mem_cgroup *memcg,int nid); -#else /* !CONFIG_MEMCG */ - -#define MEMCG_NR_GENS 1 - -struct lru_gen_memcg { -}; - -static inline void lru_gen_init_pgdat (struct pglist_data *pgdat) -{ -} - -#endif /* CONFIG_MEMCG */ -#else /* !CONFIG_LRU_GEN */ static inline void lru_gen_init_pgdat (struct pglist_data *pgdat)
@@ -590,8 +572,6 @@ static inline void lru_gen_look_around(struct page_vma_mapped_walk *pvmw) { } -#ifdef CONFIG_MEMCG -static inline void lru_gen_init_memcg (struct mem_cgroup *memcg) { }
@@ -616,8 +596,6 @@ static inline void lru_gen_soft_reclaim(struct mem_cgroup *memcg, int nid) { } -#endif /* CONFIG_MEMCG */ -#endif /* CONFIG_LRU_GEN */ struct lruvec {
mm/vmscan.c +21 -46
135 lines not on this page · raw message
Signature · 1 line
2.43.0.472.g3155946c3a-goog
PATCH 4/4 mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE
In reply to Kinsey HoImprove code readability by removing CONFIG_TRANSPARENT_HUGEPAGE, since the compiler should be able to automatically optimize out the code that promotes THPs during page table walks.
No functional changes.
--- mm/vmscan.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
mm/vmscan.c +1 -11
@@ -3273,7 +3273,6 @@ static unsigned long get_pte_pfn(pte_t pte, struct vm_area_struct *vma, unsignedreturn pfn; } -#if defined(CONFIG_TRANSPARENT_HUGEPAGE ) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG )static unsigned long get_pmd_pfn (pmd_t pmd,struct vm_area_struct *vma,unsigned long addr) {unsigned long pfn =pmd_pfn (pmd);
@@ -3291,7 +3290,6 @@ static unsigned long get_pmd_pfn(pmd_t pmd, struct vm_area_struct *vma, unsignedreturn pfn; } -#endif static struct folio *get_pfn_folio (unsigned long pfn,struct mem_cgroup *memcg,struct pglist_data *pgdat,bool can_swap)
@@ -3394,7 +3392,6 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end,return suitable_to_scan (total, young); } -#if defined(CONFIG_TRANSPARENT_HUGEPAGE ) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG )static void walk_pmd_range_locked (pud_t *pud,unsigned long addr,struct vm_area_struct *vma,struct mm_walk *args,unsigned long *bitmap,unsigned long *first) {
@@ -3472,12 +3469,6 @@ static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area done: *first =-1 ; } -#else -static void walk_pmd_range_locked (pud_t *pud,unsigned long addr,struct vm_area_struct *vma, -struct mm_walk *args,unsigned long *bitmap,unsigned long *first) -{ -} -#endif static void walk_pmd_range (pud_t *pud,unsigned long start,unsigned long end,struct mm_walk *args)
@@ -3513,7 +3504,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,continue ; } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE if (pmd_trans_huge (val)) {unsigned long pfn =pmd_pfn (val);struct pglist_data *pgdat =lruvec_pgdat (walk->lruvec);
@@ -3532,7 +3522,7 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,walk_pmd_range_locked (pud, addr, vma, args, bitmap, &first);continue ; } -#endif + walk->mm_stats[MM_NONLEAF_TOTAL ]++;if (should_clear_pmd_young ()) {
Signature · 1 line
2.43.0.472.g3155946c3a-goog
kernel test robot
build botRe: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE
kernel test robot noticed the following build errors:
Hi Kinsey,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Kinsey-Ho/mm-mglru-add-CONFIG_ARCH_HAS_HW_PTE_YOUNG/20231220-120318 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231220040037.883811-5-kinseyho%40google.com patch subject: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE config: arm-randconfig-002-20231220 (https://download.01.org/0day-ci/archive/20231221/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231221/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
mm/vmscan.c: In function 'walk_pmd_range_locked':
>> mm/vmscan.c:3455:21: error: implicit declaration of function 'pmd_dirty'; did you mean 'pte_dirty'? [-Werror=implicit-function-declaration]
3455 | if (pmd_dirty(pmd[i]) && !folio_test_dirty(folio) &&
| ^~~~~~~~~
| pte_dirtycc1: some warnings being treated as errors
vim +3455 mm/vmscan.c
bd74fdaea146029 Yu Zhao 2022-09-18 3394
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3395 static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area_struct *vma,
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3396 struct mm_walk *args, unsigned long *bitmap, unsigned long *first)
bd74fdaea146029 Yu Zhao 2022-09-18 3397 {
bd74fdaea146029 Yu Zhao 2022-09-18 3398 int i;
bd74fdaea146029 Yu Zhao 2022-09-18 3399 pmd_t *pmd;
bd74fdaea146029 Yu Zhao 2022-09-18 3400 spinlock_t *ptl;
bd74fdaea146029 Yu Zhao 2022-09-18 3401 struct lru_gen_mm_walk *walk = args->private;
bd74fdaea146029 Yu Zhao 2022-09-18 3402 struct mem_cgroup *memcg = lruvec_memcg(walk->lruvec);
bd74fdaea146029 Yu Zhao 2022-09-18 3403 struct pglist_data *pgdat = lruvec_pgdat(walk->lruvec);
bd74fdaea146029 Yu Zhao 2022-09-18 3404 int old_gen, new_gen = lru_gen_from_seq(walk->max_seq);
bd74fdaea146029 Yu Zhao 2022-09-18 3405
bd74fdaea146029 Yu Zhao 2022-09-18 3406 VM_WARN_ON_ONCE(pud_leaf(*pud));
bd74fdaea146029 Yu Zhao 2022-09-18 3407
bd74fdaea146029 Yu Zhao 2022-09-18 3408 /* try to batch at most 1+MIN_LRU_BATCH+1 entries */
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3409 if (*first == -1) {
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3410 *first = addr;
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3411 bitmap_zero(bitmap, MIN_LRU_BATCH);
bd74fdaea146029 Yu Zhao 2022-09-18 3412 return;
bd74fdaea146029 Yu Zhao 2022-09-18 3413 }
bd74fdaea146029 Yu Zhao 2022-09-18 3414
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3415 i = addr == -1 ? 0 : pmd_index(addr) - pmd_index(*first);
bd74fdaea146029 Yu Zhao 2022-09-18 3416 if (i && i <= MIN_LRU_BATCH) {
bd74fdaea146029 Yu Zhao 2022-09-18 3417 __set_bit(i - 1, bitmap);
bd74fdaea146029 Yu Zhao 2022-09-18 3418 return;
bd74fdaea146029 Yu Zhao 2022-09-18 3419 }
bd74fdaea146029 Yu Zhao 2022-09-18 3420
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3421 pmd = pmd_offset(pud, *first);
bd74fdaea146029 Yu Zhao 2022-09-18 3422
bd74fdaea146029 Yu Zhao 2022-09-18 3423 ptl = pmd_lockptr(args->mm, pmd);
bd74fdaea146029 Yu Zhao 2022-09-18 3424 if (!spin_trylock(ptl))
bd74fdaea146029 Yu Zhao 2022-09-18 3425 goto done;
bd74fdaea146029 Yu Zhao 2022-09-18 3426
bd74fdaea146029 Yu Zhao 2022-09-18 3427 arch_enter_lazy_mmu_mode();
bd74fdaea146029 Yu Zhao 2022-09-18 3428
bd74fdaea146029 Yu Zhao 2022-09-18 3429 do {
bd74fdaea146029 Yu Zhao 2022-09-18 3430 unsigned long pfn;
bd74fdaea146029 Yu Zhao 2022-09-18 3431 struct folio *folio;
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3432
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3433 /* don't round down the first address */
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3434 addr = i ? (*first & PMD_MASK) + i * PMD_SIZE : *first;
bd74fdaea146029 Yu Zhao 2022-09-18 3435
bd74fdaea146029 Yu Zhao 2022-09-18 3436 pfn = get_pmd_pfn(pmd[i], vma, addr);
bd74fdaea146029 Yu Zhao 2022-09-18 3437 if (pfn == -1)
bd74fdaea146029 Yu Zhao 2022-09-18 3438 goto next;
bd74fdaea146029 Yu Zhao 2022-09-18 3439
bd74fdaea146029 Yu Zhao 2022-09-18 3440 if (!pmd_trans_huge(pmd[i])) {
bd02df412cbb9a6 T.J. Alumbaugh 2023-05-22 3441 if (should_clear_pmd_young())
bd74fdaea146029 Yu Zhao 2022-09-18 3442 pmdp_test_and_clear_young(vma, addr, pmd + i);
bd74fdaea146029 Yu Zhao 2022-09-18 3443 goto next;
bd74fdaea146029 Yu Zhao 2022-09-18 3444 }
bd74fdaea146029 Yu Zhao 2022-09-18 3445
bd74fdaea146029 Yu Zhao 2022-09-18 3446 folio = get_pfn_folio(pfn, memcg, pgdat, walk->can_swap);
bd74fdaea146029 Yu Zhao 2022-09-18 3447 if (!folio)
bd74fdaea146029 Yu Zhao 2022-09-18 3448 goto next;
bd74fdaea146029 Yu Zhao 2022-09-18 3449
bd74fdaea146029 Yu Zhao 2022-09-18 3450 if (!pmdp_test_and_clear_young(vma, addr, pmd + i))
bd74fdaea146029 Yu Zhao 2022-09-18 3451 goto next;
bd74fdaea146029 Yu Zhao 2022-09-18 3452
bd74fdaea146029 Yu Zhao 2022-09-18 3453 walk->mm_stats[MM_LEAF_YOUNG]++;
bd74fdaea146029 Yu Zhao 2022-09-18 3454
bd74fdaea146029 Yu Zhao 2022-09-18 @3455 if (pmd_dirty(pmd[i]) && !folio_test_dirty(folio) &&
bd74fdaea146029 Yu Zhao 2022-09-18 3456 !(folio_test_anon(folio) && folio_test_swapbacked(folio) &&
bd74fdaea146029 Yu Zhao 2022-09-18 3457 !folio_test_swapcache(folio)))
bd74fdaea146029 Yu Zhao 2022-09-18 3458 folio_mark_dirty(folio);
bd74fdaea146029 Yu Zhao 2022-09-18 3459
bd74fdaea146029 Yu Zhao 2022-09-18 3460 old_gen = folio_update_gen(folio, new_gen);
bd74fdaea146029 Yu Zhao 2022-09-18 3461 if (old_gen >= 0 && old_gen != new_gen)
bd74fdaea146029 Yu Zhao 2022-09-18 3462 update_batch_size(walk, folio, old_gen, new_gen);
bd74fdaea146029 Yu Zhao 2022-09-18 3463 next:
bd74fdaea146029 Yu Zhao 2022-09-18 3464 i = i > MIN_LRU_BATCH ? 0 : find_next_bit(bitmap, MIN_LRU_BATCH, i) + 1;
bd74fdaea146029 Yu Zhao 2022-09-18 3465 } while (i <= MIN_LRU_BATCH);
bd74fdaea146029 Yu Zhao 2022-09-18 3466
bd74fdaea146029 Yu Zhao 2022-09-18 3467 arch_leave_lazy_mmu_mode();
bd74fdaea146029 Yu Zhao 2022-09-18 3468 spin_unlock(ptl);
bd74fdaea146029 Yu Zhao 2022-09-18 3469 done:
b5ff4133617d0ec T.J. Alumbaugh 2023-01-18 3470 *first = -1;
bd74fdaea146029 Yu Zhao 2022-09-18 3471 }
bd74fdaea146029 Yu Zhao 2022-09-18 3472 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE
Quoted 14 lines · kernel test robot
Hi Kinsey,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Kinsey-Ho/mm-mglru-add-CONFIG_ARCH_HAS_HW_PTE_YOUNG/20231220-120318 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231220040037.883811-5-kinseyho%40google.com patch subject: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE config: arm-randconfig-002-20231220 (https://download.01.org/0day-ci/archive/20231221/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231221/[email protected]/reproduce)
Quoted 4 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Thanks for the report.
Kinsey, please make sure you include the above tags (as well as the Closes tag from the second report in this thread) in the v2.
Quoted 8 lines
All errors (new ones prefixed by >>):
mm/vmscan.c: In function 'walk_pmd_range_locked':Quoted 1 line
Quoted 1 line
mm/vmscan.c:3455:21: error: implicit declaration of function 'pmd_dirty'; did you mean 'pte_dirty'? [-Werror=implicit-function-declaration]3455 | if (pmd_dirty(pmd[i]) && !folio_test_dirty(folio) && | ^~~~~~~~~ | pte_dirtycc1: some warnings being treated as errors
Apparetly we need the following, similar to
commit 6617da8fb565 ("mm: add dummy pmd_young() for architectures not having it")
arch/loongarch/include/asm/pgtable.h +1 -0
@@ -523,6 +523,7 @@ static inline pmd_t pmd_wrprotect(pmd_t pmd)return pmd; } +#define pmd_dirty pmd_dirtystatic inline int pmd_dirty (pmd_t pmd) {return !!(pmd_val (pmd) & (_PAGE_DIRTY | _PAGE_MODIFIED));
arch/mips/include/asm/pgtable.h +1 -0
@@ -655,6 +655,7 @@ static inline pmd_t pmd_mkwrite_novma(pmd_t pmd)return pmd; } +#define pmd_dirty pmd_dirtystatic inline int pmd_dirty (pmd_t pmd) {return !!(pmd_val (pmd) & _PAGE_MODIFIED);
arch/riscv/include/asm/pgtable.h +1 -0
@@ -673,6 +673,7 @@ static inline int pmd_write(pmd_t pmd)return pte_write (pmd_pte (pmd)); } +#define pmd_dirty pmd_dirtystatic inline int pmd_dirty (pmd_t pmd) {return pte_dirty (pmd_pte (pmd));
arch/s390/include/asm/pgtable.h +1 -0
@@ -770,6 +770,7 @@ static inline int pud_write(pud_t pud)return (pud_val (pud) & _REGION3_ENTRY_WRITE) !=0 ; } +#define pmd_dirty pmd_dirtystatic inline int pmd_dirty (pmd_t pmd) {return (pmd_val (pmd) & _SEGMENT_ENTRY_DIRTY) !=0 ;
arch/sparc/include/asm/pgtable_64.h +1 -0
@@ -706,6 +706,7 @@ static inline unsigned long pmd_write(pmd_t pmd)#define pud_write (pud) pte_write(__pte(pud_val(pud)))#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#define pmd_dirty pmd_dirtystatic inline unsigned long pmd_dirty (pmd_t pmd) {pte_t pte =__pte (pmd_val (pmd));
arch/x86/include/asm/pgtable.h +1 -0
@@ -141,6 +141,7 @@ static inline int pte_young(pte_t pte)return pte_flags (pte) & _PAGE_ACCESSED; } +#define pmd_dirty pmd_dirtystatic inline bool pmd_dirty (pmd_t pmd) {return pmd_flags (pmd) & _PAGE_DIRTY_BITS;
include/linux/pgtable.h +7 -0
@@ -184,6 +184,13 @@ static inline int pmd_young(pmd_t pmd) }#endif +#ifndef pmd_dirty +static inline int pmd_dirty (pmd_t pmd) +{ +return 0 ; +} +#endif +/* * A facility to provide lazy MMU batching. This allows PTE updates and * page invalidations to be delayed until a call to leave lazy MMU mode
kernel test robot
build botRe: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE
In reply to Kinsey Hokernel test robot noticed the following build errors:
Hi Kinsey,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Kinsey-Ho/mm-mglru-add-CONFIG_ARCH_HAS_HW_PTE_YOUNG/20231220-120318 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231220040037.883811-5-kinseyho%40google.com patch subject: [PATCH mm-unstable v1 4/4] mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20231221/[email protected]/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7022a24771c8404f847abb226735a3ae21794426) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231221/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from mm/vmscan.c:19:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from mm/vmscan.c:19:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from mm/vmscan.c:19:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> mm/vmscan.c:3455:7: error: call to undeclared function 'pmd_dirty'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
3455 | if (pmd_dirty(pmd[i]) && !folio_test_dirty(folio) &&
| ^ mm/vmscan.c:3455:7: note: did you mean 'pte_dirty'? arch/hexagon/include/asm/pgtable.h:282:19: note: 'pte_dirty' declared here
282 | static inline int pte_dirty(pte_t pte)
| ^
6 warnings and 1 error generated.
vim +/pmd_dirty +3455 mm/vmscan.c
bd74fdaea14602 Yu Zhao 2022-09-18 3394
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3395 static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area_struct *vma,
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3396 struct mm_walk *args, unsigned long *bitmap, unsigned long *first)
bd74fdaea14602 Yu Zhao 2022-09-18 3397 {
bd74fdaea14602 Yu Zhao 2022-09-18 3398 int i;
bd74fdaea14602 Yu Zhao 2022-09-18 3399 pmd_t *pmd;
bd74fdaea14602 Yu Zhao 2022-09-18 3400 spinlock_t *ptl;
bd74fdaea14602 Yu Zhao 2022-09-18 3401 struct lru_gen_mm_walk *walk = args->private;
bd74fdaea14602 Yu Zhao 2022-09-18 3402 struct mem_cgroup *memcg = lruvec_memcg(walk->lruvec);
bd74fdaea14602 Yu Zhao 2022-09-18 3403 struct pglist_data *pgdat = lruvec_pgdat(walk->lruvec);
bd74fdaea14602 Yu Zhao 2022-09-18 3404 int old_gen, new_gen = lru_gen_from_seq(walk->max_seq);
bd74fdaea14602 Yu Zhao 2022-09-18 3405
bd74fdaea14602 Yu Zhao 2022-09-18 3406 VM_WARN_ON_ONCE(pud_leaf(*pud));
bd74fdaea14602 Yu Zhao 2022-09-18 3407
bd74fdaea14602 Yu Zhao 2022-09-18 3408 /* try to batch at most 1+MIN_LRU_BATCH+1 entries */
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3409 if (*first == -1) {
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3410 *first = addr;
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3411 bitmap_zero(bitmap, MIN_LRU_BATCH);
bd74fdaea14602 Yu Zhao 2022-09-18 3412 return;
bd74fdaea14602 Yu Zhao 2022-09-18 3413 }
bd74fdaea14602 Yu Zhao 2022-09-18 3414
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3415 i = addr == -1 ? 0 : pmd_index(addr) - pmd_index(*first);
bd74fdaea14602 Yu Zhao 2022-09-18 3416 if (i && i <= MIN_LRU_BATCH) {
bd74fdaea14602 Yu Zhao 2022-09-18 3417 __set_bit(i - 1, bitmap);
bd74fdaea14602 Yu Zhao 2022-09-18 3418 return;
bd74fdaea14602 Yu Zhao 2022-09-18 3419 }
bd74fdaea14602 Yu Zhao 2022-09-18 3420
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3421 pmd = pmd_offset(pud, *first);
bd74fdaea14602 Yu Zhao 2022-09-18 3422
bd74fdaea14602 Yu Zhao 2022-09-18 3423 ptl = pmd_lockptr(args->mm, pmd);
bd74fdaea14602 Yu Zhao 2022-09-18 3424 if (!spin_trylock(ptl))
bd74fdaea14602 Yu Zhao 2022-09-18 3425 goto done;
bd74fdaea14602 Yu Zhao 2022-09-18 3426
bd74fdaea14602 Yu Zhao 2022-09-18 3427 arch_enter_lazy_mmu_mode();
bd74fdaea14602 Yu Zhao 2022-09-18 3428
bd74fdaea14602 Yu Zhao 2022-09-18 3429 do {
bd74fdaea14602 Yu Zhao 2022-09-18 3430 unsigned long pfn;
bd74fdaea14602 Yu Zhao 2022-09-18 3431 struct folio *folio;
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3432
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3433 /* don't round down the first address */
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3434 addr = i ? (*first & PMD_MASK) + i * PMD_SIZE : *first;
bd74fdaea14602 Yu Zhao 2022-09-18 3435
bd74fdaea14602 Yu Zhao 2022-09-18 3436 pfn = get_pmd_pfn(pmd[i], vma, addr);
bd74fdaea14602 Yu Zhao 2022-09-18 3437 if (pfn == -1)
bd74fdaea14602 Yu Zhao 2022-09-18 3438 goto next;
bd74fdaea14602 Yu Zhao 2022-09-18 3439
bd74fdaea14602 Yu Zhao 2022-09-18 3440 if (!pmd_trans_huge(pmd[i])) {
bd02df412cbb9a T.J. Alumbaugh 2023-05-22 3441 if (should_clear_pmd_young())
bd74fdaea14602 Yu Zhao 2022-09-18 3442 pmdp_test_and_clear_young(vma, addr, pmd + i);
bd74fdaea14602 Yu Zhao 2022-09-18 3443 goto next;
bd74fdaea14602 Yu Zhao 2022-09-18 3444 }
bd74fdaea14602 Yu Zhao 2022-09-18 3445
bd74fdaea14602 Yu Zhao 2022-09-18 3446 folio = get_pfn_folio(pfn, memcg, pgdat, walk->can_swap);
bd74fdaea14602 Yu Zhao 2022-09-18 3447 if (!folio)
bd74fdaea14602 Yu Zhao 2022-09-18 3448 goto next;
bd74fdaea14602 Yu Zhao 2022-09-18 3449
bd74fdaea14602 Yu Zhao 2022-09-18 3450 if (!pmdp_test_and_clear_young(vma, addr, pmd + i))
bd74fdaea14602 Yu Zhao 2022-09-18 3451 goto next;
bd74fdaea14602 Yu Zhao 2022-09-18 3452
bd74fdaea14602 Yu Zhao 2022-09-18 3453 walk->mm_stats[MM_LEAF_YOUNG]++;
bd74fdaea14602 Yu Zhao 2022-09-18 3454
bd74fdaea14602 Yu Zhao 2022-09-18 @3455 if (pmd_dirty(pmd[i]) && !folio_test_dirty(folio) &&
bd74fdaea14602 Yu Zhao 2022-09-18 3456 !(folio_test_anon(folio) && folio_test_swapbacked(folio) &&
bd74fdaea14602 Yu Zhao 2022-09-18 3457 !folio_test_swapcache(folio)))
bd74fdaea14602 Yu Zhao 2022-09-18 3458 folio_mark_dirty(folio);
bd74fdaea14602 Yu Zhao 2022-09-18 3459
bd74fdaea14602 Yu Zhao 2022-09-18 3460 old_gen = folio_update_gen(folio, new_gen);
bd74fdaea14602 Yu Zhao 2022-09-18 3461 if (old_gen >= 0 && old_gen != new_gen)
bd74fdaea14602 Yu Zhao 2022-09-18 3462 update_batch_size(walk, folio, old_gen, new_gen);
bd74fdaea14602 Yu Zhao 2022-09-18 3463 next:
bd74fdaea14602 Yu Zhao 2022-09-18 3464 i = i > MIN_LRU_BATCH ? 0 : find_next_bit(bitmap, MIN_LRU_BATCH, i) + 1;
bd74fdaea14602 Yu Zhao 2022-09-18 3465 } while (i <= MIN_LRU_BATCH);
bd74fdaea14602 Yu Zhao 2022-09-18 3466
bd74fdaea14602 Yu Zhao 2022-09-18 3467 arch_leave_lazy_mmu_mode();
bd74fdaea14602 Yu Zhao 2022-09-18 3468 spin_unlock(ptl);
bd74fdaea14602 Yu Zhao 2022-09-18 3469 done:
b5ff4133617d0e T.J. Alumbaugh 2023-01-18 3470 *first = -1;
bd74fdaea14602 Yu Zhao 2022-09-18 3471 }
bd74fdaea14602 Yu Zhao 2022-09-18 3472 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 17 lines · Kinsey Ho
This series is the result of the following discussion:
https://lore.kernel.org/[email protected]/It mainly avoids building the code that walks page tables on CPUs that use it, i.e., those don't support hardware accessed bit. Specifically, it introduces a new
Kconfigto guard some of functions added by commitbd74fdaea146("mm: multi-gen LRU: support page table walks") on CPUs like POWER9, on which the series was tested.Kinsey Ho (4):
mm/mglru: addCONFIG_ARCH_HAS_HW_PTE_YOUNG
mm/mglru: addCONFIG_LRU_GEN_WALKS_MMU
mm/mglru: removeCONFIG_MEMCG
mm/mglru: removeCONFIG_TRANSPARENT_HUGEPAGE
Quoted 12 lines
arch/Kconfig | 8 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 - include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 16 +- include/linux/mmzone.h | 28 +--- include/linux/pgtable.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 271 ++++++++++++++++++--------------- 11 files changed, 174 insertions(+), 167 deletions(-)
+Donet Tom <[email protected]>
who is also working on this.
Donet, could try this latest version instead? If it works well as the old one you've been using, can you please provide your Tested-by tag? Thanks.
Donet Tom
Tested-byQuoted 29 lines · Yu Zhao
Quoted 16 lines · Kinsey Ho
This series is the result of the following discussion:
https://lore.kernel.org/[email protected]/It mainly avoids building the code that walks page tables on CPUs that use it, i.e., those don't support hardware accessed bit. Specifically, it introduces a new
Kconfigto guard some of functions added by commitbd74fdaea146("mm: multi-gen LRU: support page table walks") on CPUs like POWER9, on which the series was tested.Kinsey Ho (4):
mm/mglru: addCONFIG_ARCH_HAS_HW_PTE_YOUNG
mm/mglru: addCONFIG_LRU_GEN_WALKS_MMU
mm/mglru: removeCONFIG_MEMCG
mm/mglru: removeCONFIG_TRANSPARENT_HUGEPAGEQuoted 12 lines
arch/Kconfig | 8 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 - include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 16 +- include/linux/mmzone.h | 28 +--- include/linux/pgtable.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 271 ++++++++++++++++++--------------- 11 files changed, 174 insertions(+), 167 deletions(-)
Quoted 6 lines
+Donet Tom <[email protected]>
who is also working on this.Donet, could try this latest version instead? If it works well as the old one you've been using, can you please provide your Tested-by tag? Thanks.
Hi Yu Zhao,
This patch set looks promising.
I have conducted tests on PowerPC and x86.
In old patch set there is a cleanup patch which removes struct scan_control *sc argument from try_to_inc_max_seq() and run_aging(), Do we need to include that patch?
=>Here are some test results from PowerPC.
# ls -l vmscan.o -rw-r--r--. 1 root root 3600080 Dec 19 22:35 vmscan.o
# size vmscan.o text data bss dec hex filename 95086 27412 0 122498 1de82 vmscan.o
# ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 4/8 grow/shrink: 7/9 up/down: 860/-2524 (-1664) Function old new delta should_abort_scan - 472 +472 inc_max_seq.isra 1472 1612 +140 shrink_one 680 760 +80 lru_gen_release_memcg 508 556 +48 lru_gen_init_pgdat 92 132 +40 shrink_node 4040 4064 +24 lru_gen_online_memcg 680 696 +16 lru_gen_change_state 3968 3984 +16 ------ shrink_lruvec 2168 2152 -16 lru_gen_seq_write 1980 1964 -16 isolate_folios 6904 6888 -16 lru_gen_init_memcg 32 12 -20 mm_list 24 - -24 lru_gen_exit_memcg 388 344 -44 try_to_shrink_lruvec 904 816 -88 lru_gen_rotate_memcg 832 700 -132 lru_gen_migrate_mm 132 - -132 lru_gen_seq_show 1484 1308 -176 iterate_mm_list_nowalk 288 - -288 lru_gen_look_around 2284 1984 -300 lru_gen_add_mm 528 - -528 lru_gen_del_mm 720 - -720 Total: Before=116213, After=114549, chg -1.43%
=>Here are some test results from x86.
$ ls -l vmscan.o -rw-r--r--. 1 donettom donettom 2545792 Dec 20 15:16 vmscan.o
$ size vmscan.o text data bss dec hex filename 109751 32189 0 141940 22a74 vmscan.o $
$ ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 7/3 grow/shrink: 14/4 up/down: 2307/-1534 (773) Function old new delta inc_max_seq - 1470 +1470 should_abort_scan - 229 +229 isolate_folios 4469 4562 +93 lru_gen_rotate_memcg 641 731 +90 lru_gen_init_memcg 41 99 +58 lru_gen_release_memcg 282 336 +54 lru_gen_exit_memcg 306 350 +44 walk_pud_range 2502 2543 +41 shrink_node 2912 2951 +39 lru_gen_online_memcg 402 434 +32 lru_gen_seq_show 1112 1140 +28 lru_gen_add_folio 740 757 +17 lru_gen_look_around 1217 1233 +16 __pfx_should_abort_scan - 16 +16 __pfx_inc_max_seq - 16 +16 iterate_mm_list_nowalk 277 292 +15 shrink_one 413 426 +13 lru_gen_init_lruvec 190 202 +12 ----- try_to_shrink_lruvec 717 643 -74 lru_gen_init_pgdat 196 82 -114 try_to_inc_max_seq.isra 2897 1578 -1319 Total: Before=101095, After=101868, chg +0.76% $
Thanks
Donet Tom
Yu Zhao
Acked-byQuoted 41 lines · Donet Tom
Quoted 29 lines · Yu Zhao
Quoted 16 lines · Kinsey Ho
This series is the result of the following discussion:
https://lore.kernel.org/[email protected]/It mainly avoids building the code that walks page tables on CPUs that use it, i.e., those don't support hardware accessed bit. Specifically, it introduces a new
Kconfigto guard some of functions added by commitbd74fdaea146("mm: multi-gen LRU: support page table walks") on CPUs like POWER9, on which the series was tested.Kinsey Ho (4):
mm/mglru: addCONFIG_ARCH_HAS_HW_PTE_YOUNG
mm/mglru: addCONFIG_LRU_GEN_WALKS_MMU
mm/mglru: removeCONFIG_MEMCG
mm/mglru: removeCONFIG_TRANSPARENT_HUGEPAGEQuoted 12 lines
arch/Kconfig | 8 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 - include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 16 +- include/linux/mmzone.h | 28 +--- include/linux/pgtable.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 271 ++++++++++++++++++--------------- 11 files changed, 174 insertions(+), 167 deletions(-)Quoted 6 lines
+Donet Tom <[email protected]>
who is also working on this.Donet, could try this latest version instead? If it works well as the old one you've been using, can you please provide your Tested-by tag? Thanks.
Hi Yu Zhao,
Quoted 7 lines
This patch set looks promising.
I have conducted tests on PowerPC and x86.
In old patch set there is a cleanup patch which removes struct
scan_control*sc argument fromtry_to_inc_max_seq()andrun_aging(), Do we need to include that patch?
Sorry not for including that patch in this series.
It's the first patch in the next cleanup series, which we haven't fully tested yet. It'll be the first order of business after the holiday season (mid Jan), does the schedule work for you?
Quoted 76 lines
=>Here are some test results from PowerPC.
# ls -l vmscan.o -rw-r--r--. 1 root root 3600080 Dec 19 22:35 vmscan.o# size vmscan.o text data bss dec hex filename 95086 27412 0 122498 1de82 vmscan.o# ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 4/8 grow/shrink: 7/9 up/down: 860/-2524 (-1664) Function old new delta should_abort_scan - 472 +472 inc_max_seq.isra 1472 1612 +140 shrink_one 680 760 +80 lru_gen_release_memcg 508 556 +48 lru_gen_init_pgdat 92 132 +40 shrink_node 4040 4064 +24 lru_gen_online_memcg 680 696 +16 lru_gen_change_state 3968 3984 +16 ------ shrink_lruvec 2168 2152 -16 lru_gen_seq_write 1980 1964 -16 isolate_folios 6904 6888 -16 lru_gen_init_memcg 32 12 -20 mm_list 24 - -24 lru_gen_exit_memcg 388 344 -44 try_to_shrink_lruvec 904 816 -88 lru_gen_rotate_memcg 832 700 -132 lru_gen_migrate_mm 132 - -132 lru_gen_seq_show 1484 1308 -176 iterate_mm_list_nowalk 288 - -288 lru_gen_look_around 2284 1984 -300 lru_gen_add_mm 528 - -528 lru_gen_del_mm 720 - -720 Total: Before=116213, After=114549, chg -1.43%=>Here are some test results from x86.
$ ls -l vmscan.o -rw-r--r--. 1 donettom donettom 2545792 Dec 20 15:16 vmscan.o$ size vmscan.o text data bss dec hex filename 109751 32189 0 141940 22a74 vmscan.o $$ ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 7/3 grow/shrink: 14/4 up/down: 2307/-1534 (773) Function old new delta inc_max_seq - 1470 +1470 should_abort_scan - 229 +229 isolate_folios 4469 4562 +93 lru_gen_rotate_memcg 641 731 +90 lru_gen_init_memcg 41 99 +58 lru_gen_release_memcg 282 336 +54 lru_gen_exit_memcg 306 350 +44 walk_pud_range 2502 2543 +41 shrink_node 2912 2951 +39 lru_gen_online_memcg 402 434 +32 lru_gen_seq_show 1112 1140 +28 lru_gen_add_folio 740 757 +17 lru_gen_look_around 1217 1233 +16 __pfx_should_abort_scan - 16 +16 __pfx_inc_max_seq - 16 +16 iterate_mm_list_nowalk 277 292 +15 shrink_one 413 426 +13 lru_gen_init_lruvec 190 202 +12 ----- try_to_shrink_lruvec 717 643 -74 lru_gen_init_pgdat 196 82 -114 try_to_inc_max_seq.isra 2897 1578 -1319 Total: Before=101095, After=101868, chg +0.76% $
Quoted 1 line
Tested-by Donet Tom <[email protected]>
Thanks!
Quoted 44 lines · Yu Zhao
Quoted 43 lines · Donet Tom
Quoted 29 lines · Yu Zhao
Quoted 16 lines · Kinsey Ho
This series is the result of the following discussion:
https://lore.kernel.org/[email protected]/It mainly avoids building the code that walks page tables on CPUs that use it, i.e., those don't support hardware accessed bit. Specifically, it introduces a new
Kconfigto guard some of functions added by commitbd74fdaea146("mm: multi-gen LRU: support page table walks") on CPUs like POWER9, on which the series was tested.Kinsey Ho (4):
mm/mglru: addCONFIG_ARCH_HAS_HW_PTE_YOUNG
mm/mglru: addCONFIG_LRU_GEN_WALKS_MMU
mm/mglru: removeCONFIG_MEMCG
mm/mglru: removeCONFIG_TRANSPARENT_HUGEPAGEQuoted 12 lines
arch/Kconfig | 8 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 6 - include/linux/memcontrol.h | 2 +- include/linux/mm_types.h | 16 +- include/linux/mmzone.h | 28 +--- include/linux/pgtable.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 4 + mm/vmscan.c | 271 ++++++++++++++++++--------------- 11 files changed, 174 insertions(+), 167 deletions(-)Quoted 6 lines
+Donet Tom <[email protected]>
who is also working on this.Donet, could try this latest version instead? If it works well as the old one you've been using, can you please provide your Tested-by tag? Thanks.
Hi Yu Zhao,
This patch set looks promising.
I have conducted tests on PowerPC and x86.
Quoted 9 lines
Quoted 3 lines
In old patch set there is a cleanup patch which removes struct
scan_control*sc argument fromtry_to_inc_max_seq()andrun_aging(), Do we need to include that patch?Sorry not for including that patch in this series.
It's the first patch in the next cleanup series, which we haven't fully tested yet. It'll be the first order of business after the holiday season (mid Jan), does the schedule work for you?
Yes. No Problem.
Thank you very much.
Donet Tom
Quoted 80 lines
Quoted 76 lines
=>Here are some test results from PowerPC.
# ls -l vmscan.o -rw-r--r--. 1 root root 3600080 Dec 19 22:35 vmscan.o# size vmscan.o text data bss dec hex filename 95086 27412 0 122498 1de82 vmscan.o# ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 4/8 grow/shrink: 7/9 up/down: 860/-2524 (-1664) Function old new delta should_abort_scan - 472 +472 inc_max_seq.isra 1472 1612 +140 shrink_one 680 760 +80 lru_gen_release_memcg 508 556 +48 lru_gen_init_pgdat 92 132 +40 shrink_node 4040 4064 +24 lru_gen_online_memcg 680 696 +16 lru_gen_change_state 3968 3984 +16 ------ shrink_lruvec 2168 2152 -16 lru_gen_seq_write 1980 1964 -16 isolate_folios 6904 6888 -16 lru_gen_init_memcg 32 12 -20 mm_list 24 - -24 lru_gen_exit_memcg 388 344 -44 try_to_shrink_lruvec 904 816 -88 lru_gen_rotate_memcg 832 700 -132 lru_gen_migrate_mm 132 - -132 lru_gen_seq_show 1484 1308 -176 iterate_mm_list_nowalk 288 - -288 lru_gen_look_around 2284 1984 -300 lru_gen_add_mm 528 - -528 lru_gen_del_mm 720 - -720 Total: Before=116213, After=114549, chg -1.43%=>Here are some test results from x86.
$ ls -l vmscan.o -rw-r--r--. 1 donettom donettom 2545792 Dec 20 15:16 vmscan.o$ size vmscan.o text data bss dec hex filename 109751 32189 0 141940 22a74 vmscan.o $$ ./scripts/bloat-o-meter vmscan.o.old vmscan.o add/remove: 7/3 grow/shrink: 14/4 up/down: 2307/-1534 (773) Function old new delta inc_max_seq - 1470 +1470 should_abort_scan - 229 +229 isolate_folios 4469 4562 +93 lru_gen_rotate_memcg 641 731 +90 lru_gen_init_memcg 41 99 +58 lru_gen_release_memcg 282 336 +54 lru_gen_exit_memcg 306 350 +44 walk_pud_range 2502 2543 +41 shrink_node 2912 2951 +39 lru_gen_online_memcg 402 434 +32 lru_gen_seq_show 1112 1140 +28 lru_gen_add_folio 740 757 +17 lru_gen_look_around 1217 1233 +16 __pfx_should_abort_scan - 16 +16 __pfx_inc_max_seq - 16 +16 iterate_mm_list_nowalk 277 292 +15 shrink_one 413 426 +13 lru_gen_init_lruvec 190 202 +12 ----- try_to_shrink_lruvec 717 643 -74 lru_gen_init_pgdat 196 82 -114 try_to_inc_max_seq.isra 2897 1578 -1319 Total: Before=101095, After=101868, chg +0.76% $Quoted 1 line
Tested-by Donet Tom <[email protected]>Thanks!
Acked-by Yu Zhao <[email protected]>