On Tue, May 12, 2026 at 12:32:20PM -0400, Gregory Price wrote:
> On Tue, May 12, 2026 at 11:58:27AM -0400, Michael S. Tsirkin wrote:
> > On Tue, May 12, 2026 at 11:56:02AM -0400, Gregory Price wrote:
> > > On Mon, May 11, 2026 at 05:03:35AM -0400, Michael S. Tsirkin wrote:
> > > > When two buddy pages merge in __free_one_page(), preserve
> > > > PG_zeroed on the merged page only if both buddies have the
> > > > flag set.  Otherwise clear it.
> > > > 
> > > > The merged page would inherit PG_zeroed, and a later __GFP_ZERO
> > > > allocation would skip zeroing stale data in the non-zero half.
> > > > 
> > > > Signed-off-by: Michael S. Tsirkin <[email protected]>
> > > > Assisted-by: Claude:claude-opus-4-6
> > > > Assisted-by: cursor-agent:GPT-5.4-xhigh
> > > > ---
> > > >  mm/page_alloc.c | 15 ++++++++++++++-
> > > >  1 file changed, 14 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > > index bd3b909cacdf..d70c9ba6b329 100644
> > > > --- a/mm/page_alloc.c
> > > > +++ b/mm/page_alloc.c
> > > > @@ -940,10 +940,14 @@ static inline void __free_one_page(struct page 
> > > > *page,
> > > >         unsigned long buddy_pfn = 0;
> > > >         unsigned long combined_pfn;
> > > >         struct page *buddy;
> > > > +       bool buddy_zeroed;
> > > > +       bool page_zeroed;
> > > 
> > > If you want to play some code golf, i think you can get away with a
> > > single bool here:
> > > 
> > >     bool zeroed;
> > >     zeroed = PageZeroed(buddy);
> > >     zeroed &= PageZeroed(page);
> > > 
> > >     if (zeroed)
> > >         __SetPageZeroed(page);
> > > 
> > > ~Gregory
> > 
> > Does it matter? It makes my head hurt.
> >
> 
> Less code generally means less bugs, but this is more style nits than
> anything.  Either way
> 
> Reviewed-by: Gregory Price <[email protected]>
> 
> ~Gregory


many thanks for your detailed review. I did my best to address all
comments, and sent v7. 

-- 
MST


Reply via email to