diff mbox series

fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch

Message ID 20200228104700.0af2f18d@imladris.surriel.com (mailing list archive)
State New, archived
Headers show
Series fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch | expand

Commit Message

Rik van Riel Feb. 28, 2020, 3:47 p.m. UTC
Thank you Mike & Vlastimil!

---8<---

commit 27f3cd5473d8bbf591b61d8b93b98bc333980d0d
Author: Rik van Riel <riel@surriel.com>
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@oracle.com>
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Rik van Riel <riel@surriel.com>
diff mbox series

Patch

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;