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=1794694264; b=OT/l/DeTx+QVNSFFPBd2cXC7UMMW2m5xbL35LWKhAvoRt1qrtPK6+tVrDKwvg7TGXaFP iuUl5o203YyVkGX35XeHidZ9ombdc4zP3VJsmQIAMyn0x12qYCHHEJpYStKlTiYONTRtL gtYvu9uFjQjF6s2uzMqE9msjS6dl6rXSTRYzsRFnxrV5shifJzewyNZlg3oWR4dx/LnpU cVienlBx9Tl8nX+EwfRypPLayTtQs2QAZVkaQ2XUUHx9rW6Z/Go/7lAGtVr7o6vXGfEOU +rW1UbiB/8y5vKmUiNYqbmPCEDxb0WOqjVYGy/XAKNGU/XUzznj5VfLwOibQVdDYx5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794694264; h=Received:DKIM-Signature:Date:To:From:Subject:Message-Id; bh=go7Vy/carIhKKcBz1cd/mDIJnuhiLKDJQmfiDKBFIZY=; b=mj/RW210QnJaru52QTNLNaa5K83JPVjNaOfxIShTepgpBowO6u1bXMAQ6yQ0cIqBzzGH uLyZ6FtE5anIIzPG1wV9B53Wd7GBcLP3F7MR667NTsx6OsvajCAAIA7RVX2QfoUageQpb PMPjMlGLHkFYa8VRMy1kcXKSZ6KLLEQN10hGHOHY8Fvoyvxq1elpvKPWugnK010/UrkY0 5H9nH9oLqEHYIhBQBhMDrtLQcmIjWBCTbVnkG5na/uNrq/pXG2iF9jXTaebnU+gGV5YLH qXl9/ZyPq3jBWn8YespfUKPiX85C9qSgUnQ0zJaVf+VQLZE9Fr2raK3FkSKFNcUzAAg== 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=ildFhTNl; 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 D00C4606A323 for ; Sat, 14 Nov 2026 22:11:04 +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=ildFhTNl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99AF11F000C4; Sat, 14 Nov 2026 22:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1794694264; bh=go7Vy/carIhKKcBz1cd/mDIJnuhiLKDJQmfiDKBFIZY=; h=Date:To:From:Subject; b=ildFhTNlAzr2SwFVA6uTOcOySPhTVIBjwCWTeMYLRyTFD9qxrIRk5ncSKa2F+qrGN 9mA4u5usgD4ELP7VC/Ccd62jsRgls6sfZ5o3uFQZNNCWvEjWaGr5KzH/fl8Nynj6QP yppH5X2JVSetYf5Xwvp5Bw9XdybIqg9YoOgzlcoU= Date: Sat, 14 Nov 2026 14:11:04 -0800 To: mm-commits@vger.kernel.org,lyugaofei@xiaomi.com,akpm@linux-foundation.org From: Andrew Morton Subject: + mm-mglru-avoid-prolonged-anon-reclaim-with-swappiness=200.patch added to mm-new branch Message-Id: <20261114221104.99AF11F000C4@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 prolonged anon reclaim with swappiness=200 has been added to the -mm mm-new branch. Its filename is mm-mglru-avoid-prolonged-anon-reclaim-with-swappiness=200.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-prolonged-anon-reclaim-with-swappiness=200.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: Gaofei Lyu Subject: mm/mglru: Avoid prolonged anon reclaim with swappiness=200 Date: Sun, 15 Nov 2026 04:08:01 +0800 It has been observed that swappiness=200 can significantly slow down reclaim on some machines, with some workloads running 3x slower under MGLRU than under CLRU. This is because swappiness=200 currently results in file_factor=0. Give file reclaim a small factor at lower priorities, for example, when sc->priority < DEF_PRIORITY / 2. Link: https://lore.kernel.org/20261114200803.23129-15-baohua@kernel.org Signed-off-by: Gaofei Lyu Signed-off-by: Barry Song (Xiaomi) Signed-off-by: Andrew Morton Co-developed-by: Barry Song (Xiaomi) Cc: Axel Rasmussen Cc: Baolin Wang Cc: Baoquan He Cc: Johannes Weiner Cc: Cc: Kairui Song Cc: Kunwu Chan Cc: Liam R. Howlett Cc: wang lian Cc: Cc: Michal Hocko Cc: Qi Zheng Cc: Ridong Chen Cc: Mike Rapoport Cc: Shakeel Butt Cc: Suren Baghdasaryan Cc: wangzicheng Cc: Wei Xu Cc: Yuanchu Xie Cc: Bo Zhang Cc: Hui Zhu Cc: Siddharth Chintamaneni Cc: Bo Zhang mm/vmscan.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/mm/vmscan.c~mm-mglru-avoid-prolonged-anon-reclaim-with-swappiness=200 +++ a/mm/vmscan.c @@ -4901,8 +4901,8 @@ static int get_tier_idx(struct lruvec *l * We don't calculate the scan cost. MGLRU uses lazy promotion, which will * cancel the scan budget naturally. */ -static void lru_gen_balance_scan(struct lruvec *lruvec, int swappiness, - unsigned long total_scan, unsigned long nr[]) +static void lru_gen_balance_scan(struct lruvec *lruvec, struct scan_control *sc, + int swappiness, unsigned long total_scan, unsigned long nr[]) { struct lru_gen_folio *lrugen = &lruvec->lrugen; u64 refault_rate[ANON_AND_FILE], anon_factor, file_factor; @@ -4959,7 +4959,12 @@ static void lru_gen_balance_scan(struct file_weight = nr[LRU_GEN_FILE] + nr[LRU_GEN_ANON] / size_bias; anon_factor = (u64)swappiness * refault_rate[LRU_GEN_FILE] * anon_weight; - file_factor = (u64)(MAX_SWAPPINESS - swappiness) * refault_rate[LRU_GEN_ANON] * file_weight; + if (swappiness == MAX_SWAPPINESS) + file_factor = sc->priority < AGING_PRIORITY ? + refault_rate[LRU_GEN_ANON] * file_weight : 0; + else + file_factor = (u64)(MAX_SWAPPINESS - swappiness) * + refault_rate[LRU_GEN_ANON] * file_weight; /* Cross-multiply the ratio above. */ anon_scan = mul_u64_u64_div_u64(total_scan, anon_factor, anon_factor + file_factor); @@ -5147,7 +5152,7 @@ static void lru_gen_prepare_scan(struct total = apply_proportional_protection(memcg, sc, total); total >>= sc->priority; - lru_gen_balance_scan(lruvec, swappiness, total, nr_to_scan); + lru_gen_balance_scan(lruvec, sc, swappiness, total, nr_to_scan); } static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc) @@ -5913,7 +5918,7 @@ static int run_eviction(struct lruvec *l return 0; lruvec_evictable_size(lruvec, sc, swappiness, nr_to_scan, sc->reclaim_idx + 1); - lru_gen_balance_scan(lruvec, swappiness, + lru_gen_balance_scan(lruvec, sc, swappiness, nr_to_reclaim - sc->nr_reclaimed, nr_to_scan); if (!evict_folio_lists(nr_to_scan, lruvec, sc, swappiness, MAX_LRU_BATCH, NULL)) _ Patches currently in -mm which might be from lyugaofei@xiaomi.com are mm-mglru-run-aging-when-pages-are-rare-outside-the-youngest-gen.patch mm-mglru-avoid-prolonged-anon-reclaim-with-swappiness=200.patch