Some architectures can handle different methods for determining page access count. We may want to do architecture-specific tasks reclassifying generation temperature etc during aging for such architecture. Add an arch hook to support that. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> --- include/linux/page_aging.h | 14 +++++++++++++- mm/vmscan.c | 8 +++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/linux/page_aging.h b/include/linux/page_aging.h index ab77f4578916..d7c63ce0d824 100644 --- a/include/linux/page_aging.h +++ b/include/linux/page_aging.h @@ -11,6 +11,10 @@ static inline bool arch_supports_page_access_count(void) #endif #ifdef CONFIG_LRU_GEN +bool __try_to_inc_max_seq(struct lruvec *lruvec, + unsigned long max_seq, int scan_priority, + bool can_swap, bool force_scan); + #ifndef arch_get_lru_gen_seq static inline unsigned long arch_get_lru_gen_seq(struct lruvec *lruvec, struct folio *folio) { @@ -19,8 +23,16 @@ static inline unsigned long arch_get_lru_gen_seq(struct lruvec *lruvec, struct f return lruvec->lrugen.min_seq[type]; } #endif -#endif /* CONFIG_LRU_GEN */ +#ifndef arch_try_to_inc_max_seq +static inline bool arch_try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, + int scan_priority, bool can_swap, bool force_scan) +{ + return __try_to_inc_max_seq(lruvec, max_seq, scan_priority, can_swap, force_scan); +} +#endif + +#endif /* CONFIG_LRU_GEN */ #endif diff --git a/mm/vmscan.c b/mm/vmscan.c index 518d1482f6ab..c8b98201f0b0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4536,7 +4536,13 @@ bool __try_to_inc_max_seq(struct lruvec *lruvec, static bool try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, int scan_priority, bool can_swap, bool force_scan) { - return __try_to_inc_max_seq(lruvec, max_seq, scan_priority, can_swap, force_scan); + if (arch_supports_page_access_count()) + return arch_try_to_inc_max_seq(lruvec, max_seq, + scan_priority, can_swap, + force_scan); + else + return __try_to_inc_max_seq(lruvec, max_seq, + scan_priority, can_swap, force_scan); } #endif -- 2.39.2