Skip to contentSkip to conversation

mm, page_alloc: fail has_unmovable_pages when seeing reserved pages

PATCH New [email protected] 1 participant 1 message Nov 16, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 37/131 mm, page_alloc: fail has_unmovable_pages when seeing reserved pages

From: Michal Hocko <[email protected]>
Subject: mm, page_alloc: fail has_unmovable_pages when seeing reserved pages

Reserved pages should be completely ignored by the core mm because they have a special meaning for their owners. has_unmovable_pages doesn't check those so we rely on other tests (reference count, or PageLRU) to fail on such pages. Althought this happens to work it is safer to simply check for those explicitly and do not rely on the owner of the page to abuse those fields for special purposes.

Please note that this is more of a further fortification of the code rahter than a fix of an existing issue.

---

 mm/page_alloc.c |    3 +++
 1 file changed, 3 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-fail-has_unmovable_pages-when-seeing-reserved-pages +3 -0
diff -puN mm/page_alloc.c~mm-page_alloc-fail-has_unmovable_pages-when-seeing-reserved-pages mm/page_alloc.c
@@ -7383,6 +7383,9 @@ bool has_unmovable_pages(struct zone *zo
 
 		page = pfn_to_page(check);
 
+		if (PageReserved(page))
+			return true;
+
 		/*
 		 * Hugepages are not in LRU lists, but they're movable.
 		 * We need not scan over tail pages bacause we don't

_