Re: [PATCH v1 00/11] Zero page->private when freeing pages
From: David Hildenbrand (Arm)
Date: Mon Feb 23 2026 - 04:40:40 EST
On 2/23/26 05:28, Matthew Wilcox wrote:
On Sun, Feb 22, 2026 at 10:26:30PM -0500, Zi Yan wrote:
Based on a recent discussion with David Hildenbrand on page->private
is not zero when a page is freed[1], this patchset is trying to fix all
users do not zero ->private when freeing a page and add checks to make
sure all freed pages have ->private set to zero. For compound pages,
both head page and tail pages need to have ->private set to zero.
Sorry, I didn't notice this conversation. It seems entirely unnecessary
to me to zero out page->private before freeing.
I'm a bit confused that ac1ea219590c was needed too; I thought we
cleared page->private in the allocation path, and I don't see why
it needs to be cleared in the freeing path. split_page() should be
clearing page->private.
See discussion at https://lore.kernel.org/linux-mm/cbc3b5b3-09b5-4e3c-99f0-a1f67582afff@xxxxxxxxxx/
Can we discuss this at the THP Cabal meeting on Wednesday? I don't
think that introducing this new rule that page->private must be cleared
by the users is a good idea.
The benefit is that only the users that really use page->private will also zero it out.
This implies that all pages that enter+leave the page allocator will have page->private initialized and we can also likely do:
diff --git a/mm/internal.h b/mm/internal.h
index 9e0577413087..4ecdae78e0d2 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -724,7 +724,6 @@ static inline void prep_compound_tail(struct page *head, int tail_idx)
p->mapping = TAIL_MAPPING;
set_compound_head(p, head);
- set_page_private(p, 0);
}
extern void prep_compound_page(struct page *page, unsigned int order);
Which is rather nice.
--
Cheers,
David