Skip to content

Commit 2b9b624

Browse files
Baolin Wangtorvalds
authored andcommitted
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@linux.alibaba.com Signed-off-by: Baolin Wang <[email protected]> Reviewed-by: Yang Shi <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Matthew Wilcox <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c68ed79 commit 2b9b624

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mm/migrate.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,7 @@ static struct page *alloc_misplaced_dst_page_thp(struct page *page,
21072107
static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
21082108
{
21092109
int page_lru;
2110+
int nr_pages = thp_nr_pages(page);
21102111

21112112
VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page);
21122113

@@ -2115,15 +2116,15 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
21152116
return 0;
21162117

21172118
/* Avoid migrating to a node that is nearly full */
2118-
if (!migrate_balanced_pgdat(pgdat, compound_nr(page)))
2119+
if (!migrate_balanced_pgdat(pgdat, nr_pages))
21192120
return 0;
21202121

21212122
if (isolate_lru_page(page))
21222123
return 0;
21232124

21242125
page_lru = page_is_file_lru(page);
21252126
mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_lru,
2126-
thp_nr_pages(page));
2127+
nr_pages);
21272128

21282129
/*
21292130
* Isolating the page has taken another reference, so the

0 commit comments

Comments
 (0)