Re: [PATCH 4/4] mm/page_alloc: remove set_page_private() in prep_compound_tail()

From: Zi Yan

Date: Wed Jul 01 2026 - 10:06:39 EST


On Wed Jul 1, 2026 at 8:25 AM EDT, Lance Yang wrote:
>
> On Wed, Jul 01, 2026 at 10:58:21AM +0200, David Hildenbrand (Arm) wrote:
>>On 6/29/26 04:56, Zi Yan wrote:
>>> With the subpage->private == 0 check added in a prior commit, any allocated
>>> compound page should not have nonzero subpage->private. Remove the
>
> With Vlastimil's suggestion on patch #03, we still expect tail pages to
> have 0 ->private when freed, but only check it when check_pages_enabled
> is enabled :)
>
>>> unnecessary subpage->private initialization code in compound page
>>> preparation.
>>>
>>> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
>>> ---
>>> mm/internal.h | 1 -
>>> 1 file changed, 1 deletion(-)
>>>
>>> diff --git a/mm/internal.h b/mm/internal.h
>>> index 181e79f1d6a2..c96421ce9350 100644
>>> --- a/mm/internal.h
>>> +++ b/mm/internal.h
>>> @@ -895,7 +895,6 @@ static inline void prep_compound_tail(struct page *tail,
>>> {
>>> tail->mapping = TAIL_MAPPING;
>>> set_compound_head(tail, head, order);
>>> - set_page_private(tail, 0);
>>
>>Do we want another safety check, maybe another VM_WARN_ON_ONCE?
>
> Right! I think such a check might still be useful. Same old footgun :P
>
> Cheers, Lance

Sure. Will add a VM_WARN_ON_ONCE(tail->private).



--
Best Regards,
Yan, Zi