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=1796176348; b=r232+8getlYU9V/mqHJNq1DKcul1wuNaIcwYGM82IpTqON4AhTOjs0IIRZNN/slmqCuG 2tID0994gnhcwfKWMtqwLuZkIpq8lyjhVTDxfQ+pl89ZNYj1gZV6feSQA3k3LTO0AAdm/ UThLbVAgDA+u7OFuGnJ+tOctGzNQHEkbG24qEbiZPRyf4dOf2rSdNu4mPQI/0rx8aB1q4 57FAUqjr+ABh7clBNwJ66K/03Ty6tM7ZaN+GsTJGt5DnBNkX7zB+bRY5sTSmDM4RosxMc 9tgdUxmLcYrlu+iZjPpruH1Uaqpo78N5Sck5TtfDsoZjlPgqA1UCFkbEl/YJfZF4Muw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796176348; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=DEAXA0KVamhnEix5BzS4iXABztQH2fHGZcAa+SHg3wc=; b=Q8wDyLtAq8WqKhoDoRjz1aeZg0qZmaMrFzyuUWlu3ZsaH6AYDwBLMrmU8+wEZAg2nJki SY99ujgRxP54LKYMIYczR5IrdPSQ46tRO1DvzLLKDVDxBWaVBggfqcs+EasKmsp8PF/tJ cAnePNQQo/htbmPdWaU3CvKAhSUsC7YucDM0zs9X2DsY1eBG86D1f/5zObtVza5rMhXGV NYnYgHJCOtAV1VAQwcfxycYwFLzI19emAAiDCDbWQK3y2sa+BFwpBfFS2csHlArVgSaWR 8pFhzMKAX2l9D7apTzazkfVlRywIaju7Ih6pJnx/H52BSajjLZmkuWsVDspPZOKRE+w== 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=emFxe7js; 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 DFD39606A31A for ; Wed, 2 Dec 2026 01:52:28 +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=emFxe7js Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC1C91F000C1; Wed, 2 Dec 2026 01:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796176348; bh=DEAXA0KVamhnEix5BzS4iXABztQH2fHGZcAa+SHg3wc=; h=Date:To:From:In-Reply-To:References:Subject; b=emFxe7jsQEGuDuYZWBDGMpWdgpseuV/xJWJgA61amfSFaK6Vo6Iqh+4e9w0BBalrT AP4bljUX6rGvquCVSa5ZR5VE7IF6rL2VI0/tbG/6W3Bpq+wZlLBg45kXhe9vP1YZEY IuKZ2/Q0ugSYgxdK73j1lYuT7q1OZ6gBL+hTkgp8= Date: Tue, 01 Dec 2026 17:52:28 -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-6-max.kellermann@ionos.com> References: <20261123135200.4086519-6-max.kellermann@ionos.com> Subject: + mm-mglru-reschedule-between-memcg-reclaim-attempts.patch added to mm-new branch Message-Id: <20261202015228.AC1C91F000C1@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: reschedule between memcg reclaim attempts has been added to the -mm mm-new branch. Its filename is mm-mglru-reschedule-between-memcg-reclaim-attempts.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-reschedule-between-memcg-reclaim-attempts.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: reschedule between memcg reclaim attempts Date: Mon, 23 Nov 2026 14:52:00 +0100 shrink_one() can return immediately for empty or protected memcgs, and try_to_shrink_lruvec() can break out before reaching its cond_resched(). A scan through many memcgs can repeatedly rotate entries without giving other runnable tasks a scheduling opportunity. Call cond_resched_tasks_rcu_qs() (as the existing shrink_lruvec() loop does) after shrink_one(), while the memcg reference still pins the cursor and before reacquiring the RCU read lock. Also call it between bins and nulls-marker retries, covering scans that skip every entry. Link: https://patch.msgid.link/20261123135200.4086519-6-max.kellermann@ionos.com Signed-off-by: Max Kellermann Signed-off-by: Andrew Morton Reviewed-by: Barry Song Reviewed-by: Baolin Wang Cc: Kairui Song Cc: Qi Zheng Cc: Shakeel Butt Cc: Axel Rasmussen Cc: Yuanchu Xie Cc: Wei Xu Cc: Baoquan He 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/mm/vmscan.c~mm-mglru-reschedule-between-memcg-reclaim-attempts +++ a/mm/vmscan.c @@ -5691,6 +5691,9 @@ static void shrink_many(struct pglist_da gen = get_memcg_gen(READ_ONCE(pgdat->memcg_lru.seq)); bin = first_bin = get_random_u32_below(MEMCG_NR_BINS); restart: + /* Yield between bins/retries that contain only skipped entries. */ + cond_resched_tasks_rcu_qs(); + op = 0; memcg = NULL; @@ -5721,6 +5724,14 @@ restart: op = shrink_one(lruvec, sc); + /* + * Empty or protected memcgs can bypass the + * rescheduling points in page reclaim. The memcg + * reference pins our cursor while we yield outside + * the RCU read-side critical section. + */ + cond_resched_tasks_rcu_qs(); + rcu_read_lock(); if (should_abort_scan(lruvec, sc)) _ 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