mm, page_alloc: fail has_unmovable_pages when seeing reserved pages
authorMichal Hocko <>
Thu, 16 Nov 2017 01:33:30 +0000 (17:33 -0800)
committerLinus Torvalds <>
Thu, 16 Nov 2017 02:21:02 +0000 (18:21 -0800)
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.

Signed-off-by: Michal Hocko <>
Acked-by: Vlastimil Babka <>
Cc: Igor Mammedov <>
Cc: KAMEZAWA Hiroyuki <>
Cc: Michael Ellerman <>
Cc: Reza Arbab <>
Cc: Vitaly Kuznetsov <>
Cc: Xishi Qiu <>
Cc: Yasuaki Ishimatsu <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

index 755f35f4bc8badbe9c587f7b4d7a1c0a4aa7ff92..e6106d7e9eb04d3460692985167811faf943b8e1 100644 (file)
@@ -7383,6 +7383,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
                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