The patch titled Subject: mm: migrate: introduce a local variable to get the number of pages has been added to the -mm tree. Its filename is mm-migrate-introduce-a-local-variable-to-get-the-number-of-pages.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-migrate-introduce-a-local-variable-to-get-the-number-of-pages.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-migrate-introduce-a-local-variable-to-get-the-number-of-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Subject: mm: migrate: introduce a local variable to get the number of pages Use thp_nr_pages() instead of compound_nr() to get the number of pages for THP page, meanwhile introducing a local variable 'nr_pages' to avoid getting the number of pages repeatedly. Link: https://lkml.kernel.org/r/a8e331ac04392ee230c79186330fb05e86a2aa77.1629447552.git.baolin.wang@xxxxxxxxxxxxxxxxx Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Reviewed-by: Yang Shi <shy828301@xxxxxxxxx> Cc: Alistair Popple <apopple@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/migrate.c~mm-migrate-introduce-a-local-variable-to-get-the-number-of-pages +++ a/mm/migrate.c @@ -2100,6 +2100,7 @@ out: static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) { int page_lru; + int nr_pages = thp_nr_pages(page); VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page); @@ -2108,7 +2109,7 @@ static int numamigrate_isolate_page(pg_d return 0; /* Avoid migrating to a node that is nearly full */ - if (!migrate_balanced_pgdat(pgdat, compound_nr(page))) + if (!migrate_balanced_pgdat(pgdat, nr_pages)) return 0; if (isolate_lru_page(page)) @@ -2116,7 +2117,7 @@ static int numamigrate_isolate_page(pg_d page_lru = page_is_file_lru(page); mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_lru, - thp_nr_pages(page)); + nr_pages); /* * Isolating the page has taken another reference, so the _ Patches currently in -mm which might be from baolin.wang@xxxxxxxxxxxxxxxxx are mm-memcontrol-set-the-correct-memcg-swappiness-restriction.patch mm-mempolicy-use-readable-numa_no_node-macro-instead-of-magic-numer.patch mm-migrate-simplify-the-file-backed-pages-validation-when-migrating-its-mapping.patch mm-migrate-introduce-a-local-variable-to-get-the-number-of-pages.patch mm-migrate-fix-the-incorrect-function-name-in-comments.patch mm-migrate-change-to-use-bool-type-for-page_was_mapped.patch