[PATCH 16/60] mm/oom_kill: compare OOM constraints against common memory

From: Gregory Price via B4 Relay

Date: Fri Nov 20 2026 - 13:15:50 EST


From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>

Ordinary allocations reach only common-memory zonelists. Compare policy
and cpuset constraints against N_MEMORY_COMMON, so nodes outside it
neither make an otherwise global policy appear constrained nor inflate
the constrained capacity.

Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
---
mm/oom_kill.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 5d48bd862c27..1ec22bdad1fd 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -274,9 +274,9 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)
* get_page_from_freelist().
*/
if (oc->nodemask &&
- !nodes_subset(node_states[N_MEMORY], *oc->nodemask)) {
+ !nodes_subset(node_states[N_MEMORY_COMMON], *oc->nodemask)) {
oc->totalpages = total_swap_pages;
- for_each_node_mask(nid, *oc->nodemask)
+ for_each_node_mask_state(nid, *oc->nodemask, N_MEMORY_COMMON)
oc->totalpages += node_present_pages(nid);
return CONSTRAINT_MEMORY_POLICY;
}
@@ -289,7 +289,8 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)

if (cpuset_limited) {
oc->totalpages = total_swap_pages;
- for_each_node_mask(nid, cpuset_current_mems_allowed)
+ for_each_node_mask_state(nid, cpuset_current_mems_allowed,
+ N_MEMORY_COMMON)
oc->totalpages += node_present_pages(nid);
return CONSTRAINT_CPUSET;
}

--
2.56.1