[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251114084315.155333-1-akinobu.mita@gmail.com>
Date: Fri, 14 Nov 2025 17:43:15 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: akinobu.mita@...il.com
Cc: linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
akpm@...ux-foundation.org,
axelrasmussen@...gle.com,
yuanchu@...gle.com,
weixugc@...gle.com,
hannes@...xchg.org,
david@...nel.org,
mhocko@...nel.org,
zhengqi.arch@...edance.com,
shakeel.butt@...ux.dev,
lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com,
vbabka@...e.cz,
rppt@...nel.org,
surenb@...gle.com
Subject: Re: oom-killer not invoked on systems with multiple memory-tiers
Regarding the issue I reported where processes that run out of memory cannot be
terminated by OOM when demotion_enabled is true, this can be avoided by not
demoting if the target node does not have enough free memory.
Specifically, the can_demote() function, which determines whether or not to
demote, will be changed to also check whether the target node has enough free
memory (for example, whether the minimum watermark is exceeded).
Does this change make sense?
---
mm/vmscan.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8890f4b58673..63d751e54b08 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -356,7 +356,20 @@ static bool can_demote(int nid, struct scan_control *sc,
return false;
/* If demotion node isn't in the cgroup's mems_allowed, fall back */
- return mem_cgroup_node_allowed(memcg, demotion_nid);
+ if (mem_cgroup_node_allowed(memcg, demotion_nid)) {
+ int z;
+ struct zone *zone;
+ struct pglist_data *pgdat = NODE_DATA(demotion_nid);
+ unsigned int highest_zoneidx = sc ? sc->reclaim_idx : MAX_NR_ZONES - 1;
+ int order = sc ? sc->order : 0;
+
+ for_each_managed_zone_pgdat(zone, pgdat, z, highest_zoneidx) {
+ if (zone_watermark_ok(zone, order, min_wmark_pages(zone),
+ highest_zoneidx, 0))
+ return true;
+ }
+ }
+ return false;
}
static inline bool can_reclaim_anon_pages(struct mem_cgroup *memcg,
--
2.43.0
Powered by blists - more mailing lists