[PATCH 6/8] mm/huge_memory: remove unnecessary VM_BUG_ON_PAGE()

Lorenzo Stoakes (Oracle) posted 8 patches 2 weeks, 4 days ago
There is a newer version of this series
[PATCH 6/8] mm/huge_memory: remove unnecessary VM_BUG_ON_PAGE()
Posted by Lorenzo Stoakes (Oracle) 2 weeks, 4 days ago
This has been around since the beginnings of the THP implementation. I
think we can safely assume that, if we have a THP folio, it will have a
head page.

Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
---
 mm/huge_memory.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 724e1de74367..015f6d679d26 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2469,7 +2469,6 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
 		folio = page_folio(page);
 		folio_remove_rmap_pmd(folio, page, vma);
 		WARN_ON_ONCE(folio_mapcount(folio) < 0);
-		VM_BUG_ON_PAGE(!PageHead(page), page);
 	} else if (pmd_is_valid_softleaf(orig_pmd)) {
 		const softleaf_t entry = softleaf_from_pmd(orig_pmd);
 
-- 
2.53.0
Re: [PATCH 6/8] mm/huge_memory: remove unnecessary VM_BUG_ON_PAGE()
Posted by Baolin Wang 2 weeks, 4 days ago

On 3/19/26 4:39 AM, Lorenzo Stoakes (Oracle) wrote:
> This has been around since the beginnings of the THP implementation. I
> think we can safely assume that, if we have a THP folio, it will have a
> head page.
> 
> Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---

Yes, it is under the PTL, so the PMD entry should be stable. I also 
can't think of any case where it can be not a head page.

Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>