Skip to content

Commit 547be96

Browse files
x-y-zakpm00
authored andcommitted
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: b2c9e2f ("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]>
1 parent 0111def commit 547be96

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/page_isolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
385385
* above do the rest. If migration is not possible, just fail.
386386
*/
387387
if (PageCompound(page)) {
388-
unsigned long nr_pages = compound_nr(page);
389388
struct page *head = compound_head(page);
390389
unsigned long head_pfn = page_to_pfn(head);
390+
unsigned long nr_pages = compound_nr(head);
391391

392392
if (head_pfn + nr_pages <= boundary_pfn) {
393393
pfn = head_pfn + nr_pages;

0 commit comments

Comments
 (0)