* [merged mm-stable] mm-vmscan-fix-unintended-mtc-nmask-mutation-in-alloc_demote_folio.patch removed from -mm tree
@ 2026-03-29 0:39 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-03-29 0:39 UTC (permalink / raw)
To: mm-commits, zhengqi.arch, yuanchu, weixugc, shakeel.butt, mhocko,
ljs, hannes, david, axelrasmussen, bingjiao, akpm
The quilt patch titled
Subject: mm/vmscan: fix unintended mtc->nmask mutation in alloc_demote_folio()
has been removed from the -mm tree. Its filename was
mm-vmscan-fix-unintended-mtc-nmask-mutation-in-alloc_demote_folio.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: Bing Jiao <bingjiao@google.com>
Subject: mm/vmscan: fix unintended mtc->nmask mutation in alloc_demote_folio()
Date: Tue, 3 Mar 2026 05:25:17 +0000
In alloc_demote_folio(), mtc->nmask is set to NULL for the first
allocation. If that succeeds, it returns without restoring mtc->nmask to
allowed_mask. For subsequent allocations from the migrate_pages() batch,
mtc->nmask will be NULL. If the target node then becomes full, the
fallback allocation will use nmask = NULL, allocating from any node
allowed by the task cpuset, which for kswapd is all nodes.
To address this issue, use a local copy of the mtc structure with nmask =
NULL for the first allocation attempt specifically, ensuring the original
mtc remains unmodified.
Link: https://lkml.kernel.org/r/20260303052519.109244-1-bingjiao@google.com
Fixes: 320080272892 ("mm/demotion: demote pages according to allocation fallback order")
Signed-off-by: Bing Jiao <bingjiao@google.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
--- a/mm/vmscan.c~mm-vmscan-fix-unintended-mtc-nmask-mutation-in-alloc_demote_folio
+++ a/mm/vmscan.c
@@ -985,13 +985,11 @@ static void folio_check_dirty_writeback(
static struct folio *alloc_demote_folio(struct folio *src,
unsigned long private)
{
+ struct migration_target_control *mtc, target_nid_mtc;
struct folio *dst;
- nodemask_t *allowed_mask;
- struct migration_target_control *mtc;
mtc = (struct migration_target_control *)private;
- allowed_mask = mtc->nmask;
/*
* make sure we allocate from the target node first also trying to
* demote or reclaim pages from the target node via kswapd if we are
@@ -1001,15 +999,13 @@ static struct folio *alloc_demote_folio(
* a demotion of cold pages from the target memtier. This can result
* in the kernel placing hot pages in slower(lower) memory tiers.
*/
- mtc->nmask = NULL;
- mtc->gfp_mask |= __GFP_THISNODE;
- dst = alloc_migration_target(src, (unsigned long)mtc);
+ target_nid_mtc = *mtc;
+ target_nid_mtc.nmask = NULL;
+ target_nid_mtc.gfp_mask |= __GFP_THISNODE;
+ dst = alloc_migration_target(src, (unsigned long)&target_nid_mtc);
if (dst)
return dst;
- mtc->gfp_mask &= ~__GFP_THISNODE;
- mtc->nmask = allowed_mask;
-
return alloc_migration_target(src, (unsigned long)mtc);
}
_
Patches currently in -mm which might be from bingjiao@google.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-29 0:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 0:39 [merged mm-stable] mm-vmscan-fix-unintended-mtc-nmask-mutation-in-alloc_demote_folio.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.