[Devel] [PATCH hci-8.1 3/3] mm/memcontrol: memory.numa_migrate MAX_SCAN counts folios

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 28 16:49:17 MSK 2026


memcg_numa_isolate_pages() counts a scanned folio as one whatever its
size, so the MAX_SCAN limit of memory.numa_migrate and the @nr_to_scan
arguments are in folios, not in pages as the comments say.

No functional change.

https://virtuozzo.atlassian.net/browse/VSTOR-152197

Feature: mm: interface to migrate memory between NUMA nodes upon userspace request
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/memcontrol.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4c3c06cfcf9fc..f93b0400c786d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3499,8 +3499,8 @@ static struct folio *memcg_numa_migrate_new_folio(struct folio *old_folio,
 }
 
 /*
- * Isolate at most @nr_to_scan pages from @lruvec for further migration and
- * store them in @dst. Returns the number of pages scanned. Return value of 0
+ * Isolate at most @nr_to_scan folios from @lruvec for further migration and
+ * store them in @dst. Returns the number of folios scanned. Return value of 0
  * means that @lruvec is empty.
  */
 static long memcg_numa_isolate_pages(struct lruvec *lruvec,
@@ -3661,9 +3661,9 @@ static long __memcg_numa_migrate_pages(struct lruvec *lruvec, struct list_head *
 }
 
 /*
- * Migrate at most @nr_to_scan pages accounted to @memcg to @target_nodes.
- * Pages are spreaded evenly among destination nodes. If @nr_to_scan is <= 0,
- * then the function will attempt to migrate all pages accounted to @memcg.
+ * Scan at most @nr_to_scan folios accounted to @memcg and migrate them to
+ * @target_nodes, spread evenly among the nodes. If @nr_to_scan is <= 0, the
+ * function attempts to migrate all pages accounted to @memcg.
  */
 static int memcg_numa_migrate_pages(struct mem_cgroup *memcg,
 				    nodemask_t *target_nodes, long nr_to_scan)
@@ -3750,7 +3750,7 @@ static int memcg_numa_migrate_pages(struct mem_cgroup *memcg,
  *
  * where NODELIST is a comma-separated list of ranges N1-N2 specifying the set
  * of nodes to migrate pages of this cgroup to, and the optional MAX_SCAN
- * imposes a limit on the number of pages that can be migrated in one go.
+ * imposes a limit on the number of folios scanned in one go.
  *
  * The call may be interrupted by a signal, in which case -EINTR is returned.
  */

-- 
2.43.0



More information about the Devel mailing list