From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B7C8EA4FC7 for ; Mon, 23 Feb 2026 14:52:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EC846B0005; Mon, 23 Feb 2026 09:52:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AD106B0089; Mon, 23 Feb 2026 09:52:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D00F6B008A; Mon, 23 Feb 2026 09:52:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3C1506B0005 for ; Mon, 23 Feb 2026 09:52:39 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E33DF1B49C6 for ; Mon, 23 Feb 2026 14:52:38 +0000 (UTC) X-FDA: 84476012796.21.3337E31 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf09.hostedemail.com (Postfix) with ESMTP id C89A5140010 for ; Mon, 23 Feb 2026 14:52:35 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=H4yqZFpa; spf=pass (imf09.hostedemail.com: domain of kas@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=kas@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1771858356; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eLdbReDbxTZEqTpfHTCbqUSCKin7Yq9lVC2Cf81jHIk=; b=d/UILK6HfxIcI4uarBhZpG1Lc6n194aPOKoMnZ6kFIGPP9jPQE1gjc/qTPDR0kquAHCBvN S+35gIk0Nb0AnQ8RCbB1OjZWickztBpFhNhonnv81dtSlG9uMvrfiMwkhl8Rr+4smwyVbq YP0MfkOAIQ8xnCEUnBFxex5JE2O+2+I= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=H4yqZFpa; spf=pass (imf09.hostedemail.com: domain of kas@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=kas@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1771858356; a=rsa-sha256; cv=none; b=PMD8xPTMfwBOd4uFppuuJCYJkOarIwgABLu5slijcQLhLrsneyqllWD2aA9yLI96o9IejM K3zEw3Vr2O4lNF9xQOdoFYbMQbF3kXr67tPdue0BT5+5DzDKTwPiUk9bT3AUZDprBByJ20 UiQ/Q1RX4LZwXi30k74qui8bkB1OduU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id ADF8A44472; Mon, 23 Feb 2026 14:52:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B52FEC116D0; Mon, 23 Feb 2026 14:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771858354; bh=UVAFpGopAm1uHGWKPm+YTJ1SMuDgyk8tqHgCMtYq+7M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H4yqZFpaipymBSDijM07NWYMUzRVMGQxKSvag/WbJsRZMXu8UPpkgdYVQDK+ZmOjS CQe8IAiTjs7khPJ1nlJnmZSOB5h0jRhjgvVLZ5cGZVU1pOv8frRsiEDRpqtnmbplDy Lht/XzygjzffCqWtbIO99oCnpuIBgrOWGynu0ZtOvDn7md9VbLqpMR7HcuGskaJCjA yxdNAgpnjq1fiWvog+AgwOVgenVeAJZW480BSTugFXQmZOe/CPWEGoEVF8Qof2ybAg C7pVZtKtiygDfIIXagz4qs+RaBRL6jUCnzS9rjZ1Fe+svcwKUAHOvDvuVzzk00arpC G96e2vc5zIrpA== Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfauth.phl.internal (Postfix) with ESMTP id D183DF4006C; Mon, 23 Feb 2026 09:52:32 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Mon, 23 Feb 2026 09:52:32 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvfeejhedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepmfhirhihlhcu ufhhuhhtshgvmhgruhcuoehkrghssehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvg hrnhepueeijeeiffekheeffffftdekleefleehhfefhfduheejhedvffeluedvudefgfek necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirh hilhhlodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduieduudeivdeiheeh qddvkeeggeegjedvkedqkhgrsheppehkvghrnhgvlhdrohhrghesshhhuhhtvghmohhvrd hnrghmvgdpnhgspghrtghpthhtohepheegpdhmohguvgepshhmthhpohhuthdprhgtphht thhopehvsggrsghkrgesshhushgvrdgtiidprhgtphhtthhopegurghvihgusehkvghrnh gvlhdrohhrghdprhgtphhtthhopegrkhhpmheslhhinhhugidqfhhouhhnuggrthhiohhn rdhorhhgpdhrtghpthhtohepmhhutghhuhhnrdhsohhngheslhhinhhugidruggvvhdprh gtphhtthhopeifihhllhihsehinhhfrhgruggvrggurdhorhhgpdhrtghpthhtohepuhhs rghmrggrrhhifheigedvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepfhhvughlsehgoh hoghhlvgdrtghomhdprhgtphhtthhopehoshgrlhhvrgguohhrsehsuhhsvgdruggvpdhr tghpthhtoheprhhpphhtsehkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Feb 2026 09:52:30 -0500 (EST) Date: Mon, 23 Feb 2026 14:52:25 +0000 From: Kiryl Shutsemau To: Vlastimil Babka Cc: "David Hildenbrand (Arm)" , Andrew Morton , Muchun Song , Matthew Wilcox , Usama Arif , Frank van der Linden , Oscar Salvador , Mike Rapoport , Lorenzo Stoakes , Zi Yan , Baoquan He , Michal Hocko , Johannes Weiner , Jonathan Corbet , Huacai Chen , WANG Xuerui , Palmer Dabbelt , Paul Walmsley , Albert Ou , Alexandre Ghiti , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org Subject: Re: [PATCHv6 08/17] mm: Make page_zonenum() use head page Message-ID: References: <20260202155634.650837-1-kas@kernel.org> <20260202155634.650837-9-kas@kernel.org> <6afd7334-82e8-4f87-8ed3-6448e89328c2@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: tc7gkykkp6rxsomcsq5tchh49btupoa5 X-Rspam-User: X-Rspamd-Queue-Id: C89A5140010 X-Rspamd-Server: rspam01 X-HE-Tag: 1771858355-867099 X-HE-Meta: U2FsdGVkX1+ovljKyOeOkikGng8MjxGeci0MlFC8Rw62tIm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gTd5URsiLt2HYByUMagcBseW2MUu/bBCnCj0RfwDDfZRQ1zGNxOzmwtnsD2bkhDoZ8ZISlXFQpD8TRaUnO3kBBb4/6+l5vD6DlqCw0CHqpNRelbL5Eu5oyhUGwlDoH9tGjJF0stKtDCXxcIXDJE5ZkjrjX4Z+H6R8uaecn9PS437GefQ7LoZzqUkxhijVrMoBKH0e4Wowll4FTEKgU1geqZZKZ7ugXuhdg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Feb 16, 2026 at 11:30:22AM +0000, Kiryl Shutsemau wrote: > On Tue, Feb 10, 2026 at 04:57:55PM +0100, Vlastimil Babka wrote: > > On 2/9/26 12:52, Kiryl Shutsemau wrote: > > > 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 > > >> > Acked-by: Zi Yan > > >> > --- > > >> > 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. > > > > Not thrilled by this indeed. Would it be a problem to have the shared tail > > pages per node+zone instead of just per node? > > I thought it would be overkill. It likely is going to be unused for most > nodes. But sure, move it to per-zone. I gave it a try, but stumbled on a problem. We need to know the zone in hugetlb_vmemmap_init_early(), but zones are not yet defined. hugetlb_vmemmap_init_early() is called from within sparse_init(), but span of zones is defined in free_area_init() after sparse_init(). Any ideas, how get past this? :/ -- Kiryl Shutsemau / Kirill A. Shutemov