Since the migratetype hygiene patches [0], the locking here is
a bit more formalised.
For other stuff, it's pretty obvious that it would be protected by the
zone lock. But it didn't seem totally self-evident that it should
protect the pageblock type. So it seems particularly helpful to have it
written in the code.
+
u64 max_mem_size = U64_MAX;
/* add this memory to iomem resource */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 579789600a3c7bfb7b0d847d51af702a9d4b139a..1ed21179676d05c66f77f9dbebf88e36bbe402e9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -417,6 +417,10 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
void set_pageblock_migratetype(struct page *page, int migratetype)
{
+ lockdep_assert_once(system_state == SYSTEM_BOOTING ||
+ in_mem_hotplug() ||
+ lockdep_is_held(&page_zone(page)->lock));
+