mm-vmscan-prepare-for-reparenting-mglru-folios.patch removed from -mm tree
The quilt patch titled
Subject: mm: vmscan: prepare for reparenting MGLRU folios
has been removed from the -mm tree. Its filename was
mm-vmscan-prepare-for-reparenting-mglru-folios.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Qi Zheng <[email protected]>
Subject: mm: vmscan: prepare for reparenting MGLRU folios
Date: Thu, 5 Mar 2026 19:52:44 +0800
Similar to traditional LRU folios, in order to solve the dying memcg problem, we also need to reparenting MGLRU folios to the parent memcg when memcg offline.
However, there are the following challenges:
1. Each lruvec has between MIN_NR_GENS and MAX_NR_GENS generations, the number of generations of the parent and child memcg may be different, so we cannot simply transfer MGLRU folios in the child memcg to the parent memcg as we did for traditional LRU folios.
2. The generation information is stored in folio->flags, but we cannot traverse these folios while holding the lru lock, otherwise it may cause softlockup.
3. In walk_update_folio(), the gen of folio and corresponding lru size may be updated, but the folio is not immediately moved to the corresponding lru list. Therefore, there may be folios of different generations on an LRU list.
4. In lru_gen_del_folio(), the generation to which the folio belongs is found based on the generation information in folio->flags, and the corresponding LRU size will be updated. Therefore, we need to update the lru size correctly during reparenting, otherwise the lru size may be updated incorrectly in lru_gen_del_folio().
Finally, this patch chose a compromise method, which is to splice the lru list in the child memcg to the lru list of the same generation in the parent memcg during reparenting. And in order to ensure that the parent memcg has the same generation, we need to increase the generations in the parent memcg to the MAX_NR_GENS before reparenting.
Of course, the same generation has different meanings in the parent and child memcg, this will cause confusion in the hot and cold information of folios. But other than that, this method is simple enough, the lru size is correct, and there is no need to consider some concurrency issues (such as lru_gen_del_folio()).
To prepare for the above work, this commit implements the specific functions, which will be used during reparenting.
---
include/linux/mmzone.h | 17 ++++ mm/vmscan.c | 142 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+)
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-vmscan-prepare-for-reparenting-mglru-folios +17 -0
@@ -692,6 +692,9 @@ void lru_gen_online_memcg(struct mem_cgrvoid 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); +void max_lru_gen_memcg (struct mem_cgroup *memcg,int nid); +bool recheck_lru_gen_max_memcg (struct mem_cgroup *memcg,int nid); +void lru_gen_reparent_memcg (struct mem_cgroup *memcg,struct mem_cgroup *parent,int nid);#else /* !CONFIG_LRU_GEN */
@@ -733,6 +736,20 @@ static inline void lru_gen_soft_reclaim( { } +static inline void max_lru_gen_memcg (struct mem_cgroup *memcg,int nid) +{ +} + +static inline bool recheck_lru_gen_max_memcg (struct mem_cgroup *memcg,int nid) +{ +return true; +} + +static inline +void lru_gen_reparent_memcg (struct mem_cgroup *memcg,struct mem_cgroup *parent,int nid) +{ +} +#endif /* CONFIG_LRU_GEN */ struct lruvec {
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-prepare-for-reparenting-mglru-folios +142 -0
148 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are