[PATCH] fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch
From: Rik van Riel
Date: Fri Feb 28 2020 - 10:47:10 EST
Thank you Mike & Vlastimil!
---8<---
commit 27f3cd5473d8bbf591b61d8b93b98bc333980d0d
Author: Rik van Riel <riel@xxxxxxxxxxx>
Date: Fri Feb 28 10:41:48 2020 -0500
Subject: fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch
Mike Kravetz pointed out that the second if condition could do the
wrong thing for hugetlbfs pages, and that check really only needs
to run on THPs.
Cleanup suggested by Vlastimil.
Thank you both!
Suggested-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Suggested-by: Vlastimil Babka <vbabka@xxxxxxx>
Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4afa13dd3738..71f78a590236 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8274,12 +8274,12 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page,
struct page *head = compound_head(page);
unsigned int skip_pages;
- if (PageHuge(page) &&
- !hugepage_migration_supported(page_hstate(head)))
- return page;
-
- if (!PageLRU(head) && !__PageMovable(head))
+ if (PageHuge(page)) {
+ if (!hugepage_migration_supported(page_hstate(head)))
+ return page;
+ } else if (!PageLRU(head) && !__PageMovable(head)) {
return page;
+ }
skip_pages = compound_nr(head) - (page - head);
iter += skip_pages - 1;