mm-vmscan-prevent-mglru-reclaim-from-pinning-address-space.patch removed from -mm tree
The quilt patch titled
Subject: mm/vmscan: prevent MGLRU reclaim from pinning address space
has been removed from the -mm tree. Its filename was
mm-vmscan-prevent-mglru-reclaim-from-pinning-address-space.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: Suren Baghdasaryan <[email protected]>
Subject: mm/vmscan: prevent MGLRU reclaim from pinning address space
Date: Sun, 22 Mar 2026 00:08:43 -0700
When shrinking lruvec, MGLRU pins address space before walking it. This is excessive since all it needs for walking the page range is a stable mm_struct to be able to take and release mmap_read_lock and a stable mm->mm_mt tree to walk. This address space pinning results in delays when releasing the memory of a dying process. This also prevents mm reapers (both in-kernel oom-reaper and userspace process_mrelease()) from doing their job during MGLRU scan because they check task_will_free_mem() which will yield negative result due to the elevated mm->mm_users.
This affects the system in the sense that if the MM of the killed process is being reclaimed by kswapd then reapers won't be able to reap it. Even the process itself (which might have higher-priority than kswapd) will not free its memory until kswapd drops the last reference. IOW, we delay freeing the memory because kswapd is reclaiming it. In Android the visible result for us is that process_mrelease() (userspace reaper) skips MM in such cases and we see process memory not released for an unusually long time (secs).
Replace unnecessary address space pinning with mm_struct pinning by replacing mmget/mmput with mmgrab/mmdrop calls. mm_mt is contained within mm_struct itself, therefore it won't be freed as long as mm_struct is stable and it won't change during the walk because mmap_read_lock is being held.
---
mm/vmscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-prevent-mglru-reclaim-from-pinning-address-space +3 -2
@@ -2863,8 +2863,9 @@ static struct mm_struct *get_next_mm(strreturn NULL ;clear_bit (key, &mm->lru_gen.bitmap); +mmgrab (mm); -return mmget_not_zero (mm) ? mm :NULL ; +return mm; }void lru_gen_add_mm (struct mm_struct *mm)
@@ -3064,7 +3065,7 @@ done:reset_bloom_filter (mm_state, walk->seq +1 );if (*iter) -mmput_async (*iter); +mmdrop (*iter); *iter = mm;
_
Patches currently in -mm which might be from [email protected] are