[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230418191313.268131-27-hannes@cmpxchg.org>
Date: Tue, 18 Apr 2023 15:13:13 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: linux-mm@...ck.org
Cc: Kaiyang Zhao <kaiyang2@...cmu.edu>,
Mel Gorman <mgorman@...hsingularity.net>,
Vlastimil Babka <vbabka@...e.cz>,
David Rientjes <rientjes@...gle.com>,
linux-kernel@...r.kernel.org, kernel-team@...com
Subject: [RFC PATCH 26/26] mm: page_alloc: add sanity checks for migratetypes
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@...xchg.org>
---
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
Powered by blists - more mailing lists