[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYnJCnE5vooLROnu@thinkstation>
Date: Mon, 9 Feb 2026 11:52:11 +0000
From: Kiryl Shutsemau <kas@...nel.org>
To: "David Hildenbrand (Arm)" <david@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <muchun.song@...ux.dev>, Matthew Wilcox <willy@...radead.org>,
Usama Arif <usamaarif642@...il.com>, Frank van der Linden <fvdl@...gle.com>,
Oscar Salvador <osalvador@...e.de>, Mike Rapoport <rppt@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Zi Yan <ziy@...dia.com>, Baoquan He <bhe@...hat.com>, Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>, Jonathan Corbet <corbet@....net>,
Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>,
Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>, kernel-team@...a.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
loongarch@...ts.linux.dev, linux-riscv@...ts.infradead.org
Subject: Re: [PATCHv6 08/17] mm: Make page_zonenum() use head page
On Thu, Feb 05, 2026 at 02:10:40PM +0100, David Hildenbrand (Arm) wrote:
> On 2/2/26 16:56, Kiryl Shutsemau wrote:
> > With the upcoming changes to HVO, a single page of tail struct pages
> > will be shared across all huge pages of the same order on a node. Since
> > huge pages on the same node may belong to different zones, the zone
> > information stored in shared tail page flags would be incorrect.
> >
> > Always fetch zone information from the head page, which has unique and
> > correct zone flags for each compound page.
> >
> > Signed-off-by: Kiryl Shutsemau <kas@...nel.org>
> > Acked-by: Zi Yan <ziy@...dia.com>
> > ---
> > include/linux/mmzone.h | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> > index be8ce40b5638..192143b5cdc0 100644
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -1219,6 +1219,7 @@ static inline enum zone_type memdesc_zonenum(memdesc_flags_t flags)
> > static inline enum zone_type page_zonenum(const struct page *page)
> > {
> > + page = compound_head(page);
> > return memdesc_zonenum(page->flags);
>
> We end up calling page_zonenum() without holding a reference.
>
> Given that _compound_head() does a READ_ONCE(), this should work even if we
> see concurrent page freeing etc.
>
> However, this change implies that we now perform a compound page lookup for
> every PageHighMem() [meh], page_zone() [quite some users in the buddy,
> including for pageblock access and page freeing].
>
> That's a nasty compromise for making HVO better? :)
>
> We should likely limit that special casing to kernels that really rquire it
> (HVO).
I will add compound_info_has_mask() check.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists