[PATCH 36/60] mm: refuse explicit reclaim and compaction of private nodes
From: Gregory Price via B4 Relay
Date: Fri Nov 20 2026 - 13:16:17 EST
From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>
kswapd and kcompactd do not run on private nodes, but nodeN/reclaim and
nodeN/compact name a node directly. Reject them for a private node with
-EOPNOTSUPP.
Memoryless nodes keep accepting the requests.
Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
---
mm/compaction.c | 3 +++
mm/vmscan.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/mm/compaction.c b/mm/compaction.c
index 879f372a891e..283d4d4e78c3 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -3038,6 +3038,9 @@ static ssize_t compact_store(struct device *dev,
int nid = dev->id;
if (nid >= 0 && nid < nr_node_ids && node_online(nid)) {
+ if (node_state(nid, N_MEMORY_PRIVATE))
+ return -EOPNOTSUPP;
+
/* Flush pending updates to the LRU lists */
lru_add_drain_all();
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5b53e0391d80..3e934135e805 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -8268,6 +8268,9 @@ static ssize_t reclaim_store(struct device *dev,
{
int ret, nid = dev->id;
+ if (node_state(nid, N_MEMORY_PRIVATE))
+ return -EOPNOTSUPP;
+
ret = user_proactive_reclaim((char *)buf, NULL, NODE_DATA(nid));
return ret ? ret : count;
}
--
2.56.1