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

From: "Michael S. Tsirkin" <[email-masked]>
Date: Tue, 12 May 2026 12:35:04 -0400

On Mon, May 11, 2026 at 10:49:06PM -0400, Gregory Price wrote:
> 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

BTW it does mean we need to use vmf->real_address there as user_addr
as opposed to vmf->address which is HP aligned.
I guess I'll switch everyone to use real_address then, for consistency.

-- 
MST