[RFC PATCH 26/26] mm: page_alloc: add sanity checks for migratetypes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that known block pollution from fallbacks, !movable compaction,
highatomic reserves and single THP pcplists is gone, add high-level
sanity checks that ensure that pages coming out of the allocator are
of the requested migratetype.

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
---
 mm/page_alloc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9db588a1de3b..b8767a6075e8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3675,6 +3675,7 @@ struct page *rmqueue(struct zone *preferred_zone,
 			int migratetype)
 {
 	struct page *page;
+	int buddy = 0;
 
 	/*
 	 * We most definitely don't want callers attempting to
@@ -3698,9 +3699,14 @@ struct page *rmqueue(struct zone *preferred_zone,
 
 	page = rmqueue_buddy(preferred_zone, zone, order, alloc_flags,
 							migratetype);
+	buddy = 1;
 
 out:
 	VM_BUG_ON_PAGE(page && bad_range(zone, page), page);
+	VM_WARN_ONCE(page && get_pageblock_migratetype(page) != migratetype,
+		     "%d:%s order=%u gfp=%pGg mt=%s alloc_flags=%x buddy=%d\n",
+		     zone_to_nid(zone), zone->name, order, &gfp_flags,
+		     migratetype_names[migratetype], alloc_flags, buddy);
 	return page;
 }
 
-- 
2.39.2





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux