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=1796176346; b=MKudozPG9sNUNxA+HTPc7X/uSbar8qyYJbjyh47C9eBZTNSGFQCCQ/8wQvQdT9syIMxF UUxeTLnKB/oQ+P7yLBGz4yo/XjRi+3Xc6+Ql52GYl2xuEOce1laC7jctEXyhUFa8p83PB 1RxXT9EG4T0K0muVmulF171rbtRYD0nyIuKS10vuzqc6lRExhuDtzPgPFWEwaBQZRGJVe bSlUBRzXdzzph7EDG46ok4ASAkmKeGyLzLdJq9PLK7aPFxw50ccRoh+z82Nde6zr8llsV qrSG47D8a52bPt3oNF+4NEBmm+tfnHzSiYDm7NNb3FCJhwm9AlVr9YIzqYUWW57GXXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796176346; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=Y5WlGUPsMR0XwsS8z/UJLt2v2jkRLHNLj9yKHtXODWI=; b=oG1hnxyeaP+bz0N85ryCHb11QAgs9vkCl7Wsm47+pgKAKP2K2d8ap4LOriqypJTgb9eH O4e0aTyQ/snD7npiwEnCroxbC3Pv7qXGhNfXaQQmI1YS3wdILtq614YjNmwGvFmAmS5ln zjE1UozJSbYqpCYWnzjzB0KEhUj2LjBVQCiHFl5jR2RHrhfptsQ+PSYtnPKmmjMS0+o1Y yaBFtfWqN9N0ZjETNLKgMDtUajM6orQLYnKlb1vFws6DzUsSr1s1JAOJz5ErGa3jCuTl1 fRgYI93ELeYXn+0umA6kVS5j5xEsmD1YSz4HoyAiGyIpieYFb+JgyWIy76jF7LVM4vw== 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=CrVVIKbH; 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 A66C0606A31A for ; Wed, 2 Dec 2026 01:52:26 +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=CrVVIKbH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 711C41F000C1; Wed, 2 Dec 2026 01:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796176346; bh=Y5WlGUPsMR0XwsS8z/UJLt2v2jkRLHNLj9yKHtXODWI=; h=Date:To:From:In-Reply-To:References:Subject; b=CrVVIKbH78Lk+iRy/nfm99xrNoeERRf8Mw9lgaybLL+xtfQmSKks0FIWCJxbjInrT hyxcYhleMg5wNIQVrwQac3/pgj2Fy/36yMDPzMfEPe/XLGel969aN85geSAIGR/SpR ZjBX8Aj1kSIvFt485w2fXXGXKh3jfRfaIRGIhO9E= Date: Tue, 01 Dec 2026 17:52:26 -0800 To: mm-commits@vger.kernel.org,yuanchu@google.com,weixugc@google.com, vbabka@kernel.org,surenb@google.com,shakeel.butt@linux.dev,rppt@kernel.org, ridong.chen@linux.dev,qi.zheng@linux.dev,paulmck@kernel.org,mhocko@suse.com, ljs@kernel.org,liam@infradead.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,max.kellermann@ionos.com, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261123135200.4086519-5-max.kellermann@ionos.com> References: <20261123135200.4086519-5-max.kellermann@ionos.com> Subject: + mm-mglru-avoid-redundant-rotations-of-young-memcgs.patch added to mm-new branch Message-Id: <20261202015226.711C41F000C1@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: avoid redundant rotations of young memcgs has been added to the -mm mm-new branch. Its filename is mm-mglru-avoid-redundant-rotations-of-young-memcgs.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-avoid-redundant-rotations-of-young-memcgs.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: Max Kellermann Subject: mm/mglru: avoid redundant rotations of young memcgs Date: Mon, 23 Nov 2026 14:51:59 +0100 Concurrent reclaimers can request promotion after another reclaimer has already moved a memcg into the young generation. Requeueing it into a random bin again adds list mutations without advancing the old-generation scan. Therefore, skip `MEMCG_LRU_YOUNG` when the memcg is already in the default segment of the current young generation. In my micro benchmark, this increases the request rate by 36% and reduces the average duration of each write request by 27%. Link: https://patch.msgid.link/20261123135200.4086519-5-max.kellermann@ionos.com Signed-off-by: Max Kellermann Signed-off-by: Andrew Morton Reviewed-by: Barry Song Cc: Kairui Song Cc: Qi Zheng Cc: Shakeel Butt Cc: Axel Rasmussen Cc: Yuanchu Xie Cc: Wei Xu Cc: Baoquan He Cc: Baolin Wang Cc: David Hildenbrand Cc: Lorenzo Stoakes Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Johannes Weiner Cc: "Paul E. McKenney" Cc: Ridong Chen mm/vmscan.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/mm/vmscan.c~mm-mglru-avoid-redundant-rotations-of-young-memcgs +++ a/mm/vmscan.c @@ -4780,6 +4780,14 @@ static void lru_gen_rotate_memcg(struct else VM_WARN_ON_ONCE(true); + if (op == MEMCG_LRU_YOUNG && old == new && lruvec->lrugen.seg == seg) + /* + * This memcg is already in the young generation and + * reshuffling it again cannot help the scan of the + * old generation. + */ + goto unlock; + WRITE_ONCE(lruvec->lrugen.seg, seg); WRITE_ONCE(lruvec->lrugen.gen, new); @@ -4792,6 +4800,7 @@ static void lru_gen_rotate_memcg(struct if (!pgdat->memcg_lru.nr_memcgs[old] && old == get_memcg_gen(pgdat->memcg_lru.seq)) WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1); +unlock: spin_unlock_irqrestore(&pgdat->memcg_lru.lock, flags); } _ Patches currently in -mm which might be from max.kellermann@ionos.com are include-linux-rculist_nulls-add-hlist_nulls_add_behind_last_rcu.patch mm-vmscan-move-code-to-lru_gen_adddel_memcg.patch mm-mglru-cache-the-last-memcg-node-make-tail-insertion-constant-time.patch mm-mglru-avoid-redundant-rotations-of-young-memcgs.patch mm-mglru-reschedule-between-memcg-reclaim-attempts.patch