Re: [PATCH resend v6 14/30] mm: hugetlb: use __GFP_ZERO and skip zeroing for zeroed pages

From: Gregory Price

Date: Mon May 11 2026 - 22:49:20 EST


On Mon, May 11, 2026 at 05:47:48PM -0400, Michael S. Tsirkin wrote:
> On Mon, May 11, 2026 at 12:36:59PM -0400, Gregory Price wrote:
> >
> > This feels like a very odd pattern:
> >
> > 1) ask for __GFP_ZERO
> > 2) Have to check whether it was actually zeroed
> >
> > Seems like the zeroing piece should just be sunk in if you're going to
> > ask for __GFP_ZERO anyway. And in that case, maybe just `bool zero` as
> > an argument, rather than GFP (to avoid future overloading of flags).
> >
> > ~Gregory
>
> Heh. The reason is that it either allocates from buddy - using gfp flags
> or from the pool, in which case it zeroes.
>
> We could even avoid the bool - just test __GFP_ZERO inside
> alloc_hugetlb_folio. Would that be better?
>

Hard to know until we see the full shape of things, but it seems
reasonable if we can eliminate one or both new arguments that this would
be a good thing and the logic should just be sunk into hugetlb.

~Gregory