diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index c9cc42e54f05..0ab9a6e09222 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1832,6 +1832,13 @@ static int scan_movable_pages(unsigned long start, unsigned long end, if (PageOffline(page) && page_count(page)) return -EBUSY; + /* + * A page that was allocated, but was not a slab page yet, when + * its pageblock was isolated. + */ + if (PageSlab(page)) + return -EBUSY; + folio = page_folio(page); if (!folio_test_hugetlb(folio)) continue; diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 5aaad037384e..f4f0571607ab 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -74,6 +74,13 @@ bool page_is_unmovable(struct zone *zone, struct page *page, return false; } + /* + * Slab pages are frozen: do not take their reference count of zero + * for that of a free page. + */ + if (PageSlab(page)) + return true; + /* * We can't use page_count without pin a page * because another CPU can free compound page.