From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795987122; b=nY8A7ZSkmEm3zOtuFJ1jrzr3n2f2lG8UeAvHOkeBVEWzJWiopkHOXqvFvCwR8hvXt5X+ +u8sBiyK+enoe21Jij69/nkzbYFCXOz48n4+FHjUpFCvNWbG7lzKj7j+sK6MilTlp8Ouz p5DMYU1lZL+Y1yzpLycNuMvLnOQLnVldVN9ZCcJEYvqfEcxlyWh/v2pec91MYDcYz4ir9 PuXF9BSQ/gJuieRU0qSUXaSfjGm+3olsOhaF2or5xJBzKpcl/L3E/cMVi6G+tiPHpqwUd a3UJSg+NGXNJ/vrvJ8xuKSSn+jgvfKXv0PEDBbdkEG/OkACiORvqnDV2jf4Bpk6tybw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795987122; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=cYe8F6yOEyLHHfC3UHARdWnMk0rJ4GnKqQ04xZ7nIL8=; b=dM53Vy+/3SIzhdTwpuwC7qil8xbA2MbxGvb+IBjD1VX6MP7ZQgc61LeufxMiR5gRPZN4 1AlfSwhdgPbXM01B+owjXgv3SSWwNiPvtyJbIZqbuh4eDECI65yYX6h83DPB3gCbagrsb 0MnDRZANaLLjvu6o6OG0X+El8rXyOc1s+ZWxkK9KHbb/u3CFnUFTpNmWjHOeXOqKzRqGK DGij2NKkMaXl+kBP7wn89PfSZQDEISpZmv2WlD0ez+AOfRnosm8l3pZXb2TUFXky7D3te PEzv+cu0xt3ola8EZipA551fCpR04DMVsFuacxG/QTFSHmtUcCQSPdIpT2odvM4h+Hw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=vNAzfbTn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42439606A31C for ; Sun, 29 Nov 2026 21:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=vNAzfbTn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AE5B1F00A17; Sun, 29 Nov 2026 21:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795987121; bh=cYe8F6yOEyLHHfC3UHARdWnMk0rJ4GnKqQ04xZ7nIL8=; h=Date:To:From:In-Reply-To:References:Subject; b=vNAzfbTnCe2ucXjWgUkzrPNGF8hBiYh2yK41uflV12GeIGfSUJXhHsi44tvUP2VAP B2Na6NsH+35avAywFFshOIKKEgFPhQeXnVFzOIuEm162/u+JU/18XdaRmG7cCJUTvH xToNRfDz996gzYkA7RkQgMi+xBj8Ono1dF8lTGkE= Date: Sun, 29 Nov 2026 13:18:41 -0800 To: mm-commits@vger.kernel.org,yuzhao@google.com,yuanchu@google.com, weixugc@google.com,shakeel.butt@linux.dev,ridong.chen@linux.dev, qi.zheng@linux.dev,mhocko@kernel.org,kasong@tencent.com,hannes@cmpxchg.org, david@kernel.org,baoquan.he@linux.dev,baolin.wang@linux.alibaba.com, baohua@kernel.org,axelrasmussen@google.com,mason@kernel.org, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261129143759.96221-2-baohua@kernel.org> References: <20261129143759.96221-2-baohua@kernel.org> Subject: + mm-mglru-count-all-generations-as-evictable.patch added to mm-new branch Message-Id: <20261129211841.9AE5B1F00A17@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/mglru: count all generations as evictable has been added to the -mm mm-new branch. Its filename is mm-mglru-count-all-generations-as-evictable.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-count-all-generations-as-evictable.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Chris Mason Subject: mm/mglru: count all generations as evictable Date: Sun, 29 Nov 2026 22:37:57 +0800 Patch series "mm/mglru: fix a few reclaim issues". This series contains three MGLRU fixes originally proposed by Chris Mason and passed on to us by David Hildenbrand. The issues addressed are: 1. Reparented folios becoming unreclaimable due to generation accounting falling outside the parent's [min_seq, max_seq] range. 2. A potential deadlock between reclaim and compaction when isolating folios. 3. Missing vmpressure notifications for global reclaim on cgroup v1. Kairui and I have reviewed the fixes and made minor adjustments where necessary. The series is based on mm-new. This patch (of 3): With MGLRU enabled, clean page cache that was reparented from a removed memory cgroup can stay unreclaimable for as long as the parent has no other evictable folios on the same node. try_to_shrink_lruvec() derives its scan count from lruvec_evictable_size(), and with a count of 0 it runs neither eviction nor aging. lruvec_evictable_size() adds up nr_pages[] only for the generations from min_seq to max_seq. That sum is complete only if the count of a generation is 0 by the time min_seq advances past it. But try_to_inc_min_seq() ignores the counts: it advances min_seq past a generation as soon as the lists of that generation are empty. A folio that folio_update_gen() promoted is counted in its new generation, but stays on the list of the generation that it came from. Normally min_seq stops at that list, before it reaches the new generation. Reparenting moves each list and each count to the same index in the parent, where that index can stand for a different age: index (seq % MAX_NR_GENS) 0 1 2 3 seq in the child 0 1 2 3 seq in the parent 4 5 6 3 folio F: on folios[0], counted in nr_pages[3] child: folios[0] holds min_seq at 0 parent: folios[3] is empty, so min_seq goes from 3 to 4 sum: nr_pages[0] + nr_pages[1] + nr_pages[2] = 0, without F The fix used here is to add up nr_pages[] of all MAX_NR_GENS generations in lruvec_evictable_size(). [baohua@kernel.org: Rebased onto mm-new and added comments] Link: https://lore.kernel.org/20261129143759.96221-1-baohua@kernel.org Link: https://patch.msgid.link/20261129143759.96221-2-baohua@kernel.org Fixes: 163bc3d68c9f ("mm/mglru: restructure the reclaim loop") Signed-off-by: Chris Mason Signed-off-by: Barry Song (Xiaomi) Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Cc: Johannes Weiner Cc: Michal Hocko Cc: Qi Zheng Cc: Shakeel Butt Cc: Kairui Song Cc: Axel Rasmussen Cc: Yuanchu Xie Cc: Wei Xu Cc: Baoquan He Cc: Baolin Wang Cc: Ridong Chen Cc: Yu Zhao mm/vmscan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/mm/vmscan.c~mm-mglru-count-all-generations-as-evictable +++ a/mm/vmscan.c @@ -4272,8 +4272,6 @@ static void lruvec_evictable_size(struct struct lru_gen_folio *lrugen = &lruvec->lrugen; struct mem_cgroup *memcg = lruvec_memcg(lruvec); int nid = lruvec_pgdat(lruvec)->node_id; - DEFINE_MAX_SEQ(lruvec); - DEFINE_MIN_SEQ(lruvec); nr[LRU_GEN_ANON] = 0; nr[LRU_GEN_FILE] = 0; @@ -4281,7 +4279,12 @@ static void lruvec_evictable_size(struct for_each_evictable_type(type, swappiness) { if (type == LRU_GEN_ANON && !can_reclaim_anon_pages(memcg, nid, sc)) continue; - for (seq = min_seq[type]; seq <= max_seq; seq++) + /* + * Reparenting can leave folios accounted for in + * generations outside [min_seq, max_seq]. Count + * them as well to ensure reclaim makes progress. + */ + for (seq = 0; seq < MAX_NR_GENS; seq++) nr[type] += lruvec_gen_size(lrugen, type, seq, max_zone); } } _ Patches currently in -mm which might be from mason@kernel.org are mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch