Re: [PATCH 2/2] mm/memory_hotplug: remove head page reference in scan_movable_pages()

From: Matthew Wilcox
Date: Mon Jan 23 2023 - 15:41:46 EST


On Mon, Jan 23, 2023 at 12:23:47PM -0800, Sidhartha Kumar wrote:
> - if (!PageHuge(page))
> + folio = page_folio(page);
> + if (!folio_test_hugetlb(folio))
> continue;
> - head = compound_head(page);
> /*
> * This test is racy as we hold no reference or lock. The
> * hugetlb page could have been free'ed and head is no longer

Assuming the comment is correct, this patch is also unsafe.