The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-55.13.1.2.3.vz10 ------> commit 6e222f07ddc3c3d9637f6686480d8bf4af2e3012 Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Tue Sep 2 18:59:14 2025 +0800
mm/memcontrol: completely switch memcg_numa_isolate_pages() to folio Almost everything is in folios already, so let's switch and remove, now excess, page variable completely. https://virtuozzo.atlassian.net/browse/VSTOR-114298 Fixes: c92459bc18307 ("mm: memcontrol: add memory.numa_migrate file") Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Feature: mm: interface to migrate memory between NUMA nodes upon userspace request --- mm/memcontrol.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2c707716d0557..6eb8202f5d4c0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3513,7 +3513,6 @@ static long memcg_numa_isolate_pages(struct lruvec *lruvec, enum lru_list lru, struct list_head *src = &lruvec->lists[lru]; struct pglist_data *pgdat = lruvec_pgdat(lruvec); unsigned long nr_zone_taken[MAX_NR_ZONES] = { 0 }; - struct page *page; long scanned = 0, taken = 0; struct folio *folio = NULL; struct address_space *mapping; @@ -3524,7 +3523,6 @@ static long memcg_numa_isolate_pages(struct lruvec *lruvec, enum lru_list lru, while (!list_empty(src) && scanned < nr_to_scan && taken < nr_to_scan) { int nr_pages; struct list_head *move_to = src; - page = list_last_entry(src, struct page, lru); scanned++; @@ -3540,8 +3538,10 @@ static long memcg_numa_isolate_pages(struct lruvec *lruvec, enum lru_list lru, * isolate_migratepages_block(), mode variable is defined and * set to ISOLATE_ASYNC_MIGRATE in order to keep the original * code unchanged where possible. + * + * Also it is switched to folio, based on isolate_lru_folios(). */ - folio = page_folio(page); + folio = lru_to_folio(src); /* * Migration will fail if an anonymous page is pinned in memory, @@ -3613,25 +3613,25 @@ static long memcg_numa_isolate_pages(struct lruvec *lruvec, enum lru_list lru, } /* - * Be careful not to clear PageLRU until after we're - * sure the page is not being freed elsewhere -- the - * page release code relies on it. + * Be careful not to clear the lru flag until after we're + * sure the folio is not being freed elsewhere -- the + * folio release code relies on it. */ - if (unlikely(!get_page_unless_zero(page))) + if (unlikely(!folio_try_get(folio))) goto isolate_fail; - if (!TestClearPageLRU(page)) { + if (!folio_test_clear_lru(folio)) { /* Another thread is already isolating this page */ - put_page(page); + folio_put(folio); goto isolate_fail; } - nr_pages = thp_nr_pages(page); + nr_pages = folio_nr_pages(folio); taken += nr_pages; - nr_zone_taken[page_zonenum(page)] += nr_pages; + nr_zone_taken[folio_zonenum(folio)] += nr_pages; move_to = dst; isolate_fail: - list_move(&page->lru, move_to); + list_move(&folio->lru, move_to); } __mod_node_page_state(pgdat, NR_LRU_BASE + lru, -taken); __mod_node_page_state(pgdat, NR_ISOLATED_ANON + is_file_lru(lru), taken); _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel