Re: [PATCH v7 02/31] mm: page_alloc: propagate PageReported flag across buddy splits
From: Michael S. Tsirkin
Date: Thu May 14 2026 - 11:44:32 EST
On Thu, May 14, 2026 at 11:32:26AM -0400, Gregory Price wrote:
> On Thu, May 14, 2026 at 10:48:28AM -0400, Michael S. Tsirkin wrote:
> > On Thu, May 14, 2026 at 07:51:03AM -0400, Gregory Price wrote:
> > > On Tue, May 12, 2026 at 05:05:16PM -0400, Michael S. Tsirkin wrote:
> > > > When a reported free page is split via expand() to satisfy a
> > > > smaller allocation, the sub-pages placed back on the free lists
> > > > lose the PageReported flag. This means they will be unnecessarily
> > > > re-reported to the hypervisor in the next reporting cycle, wasting
> > > > work.
> > > >
> > > > While I was unable to quantify the performance difference, it is
> > > > an obvious waste, even if small.
> > > >
> > > > Propagate the PageReported flag to sub-pages during expand(),
> > > > both in page_del_and_expand() and try_to_claim_block(), so
> > > > that they are recognized as already-reported.
> > > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> > > > Assisted-by: Claude:claude-opus-4-6
> > > ... snip ...
> > > > @@ -1731,9 +1740,10 @@ static __always_inline void page_del_and_expand(struct zone *zone,
> > > > int high, int migratetype)
> > > > {
> > > > int nr_pages = 1 << high;
> > > > + bool was_reported = page_reported(page);
> > > >
> > > > __del_page_from_free_list(page, zone, high, migratetype);
> > > > - nr_pages -= expand(zone, page, low, high, migratetype);
> > > > + nr_pages -= expand(zone, page, low, high, migratetype, was_reported);
> > > > account_freepages(zone, -nr_pages, migratetype);
> > > > }
> > > >
> > >
> > > Maybe mildly out of scope but worth asking: Are there other flags that
> > > should be retained/propogated on a split? If so, rather than pass
> > > was_reported, should we just take a temporary copy of the page flags and
> > > pass them all in?
> > >
> > > ~Gregory
> >
> >
> > Not that I can see, no.
> >
>
> You do this exact thing again later :]
>
> https://lore.kernel.org/linux-mm/9a22e0f9bbe1278913754db6df76e291a006181a.1778616612.git.mst@xxxxxxxxxx/
>
> ~Gregory
I mean yes, reported and zeroed) Just zeroed does not exist at this
stage in the series.