diff options
author | Zi Yan <[email protected]> | 2022-05-30 22:44:50 -0400 |
---|---|---|
committer | akpm <[email protected]> | 2022-06-01 15:57:16 -0700 |
commit | 547be963c99f1e9ebc1cfabf630f64601a98dd00 (patch) | |
tree | 052f20809627f139d0588a42a275b2a8d8e9709e | |
parent | 0111def915b280c64c05f73f01b59ca404255aa3 (diff) |
mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock()
When compound_nr(page) was used, page was not guaranteed to be the head of
the compound page and it could cause an infinite loop. Fix it by calling
it on the head page.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
Signed-off-by: Zi Yan <[email protected]>
Reported-by: Anshuman Khandual <[email protected]>
Link: https://lore.kernel.org/linux-mm/[email protected]/
Reviewed-by: Anshuman Khandual <[email protected]>
Reviewed-by: Miaohe Lin <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Acked-by: Muchun Song <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Eric Ren <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Christophe Leroy <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r-- | mm/page_isolation.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 6021f8444b5a..d200d41ad0d3 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, * above do the rest. If migration is not possible, just fail. */ if (PageCompound(page)) { - unsigned long nr_pages = compound_nr(page); struct page *head = compound_head(page); unsigned long head_pfn = page_to_pfn(head); + unsigned long nr_pages = compound_nr(head); if (head_pfn + nr_pages <= boundary_pfn) { pfn = head_pfn + nr_pages; |