From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C152F3A9627 for ; Thu, 14 May 2026 08:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778746626; cv=none; b=FVTUw0RoMv9Wvy/ZKhxE0QfLyn1D5Gvlc2NE4jgHMmIm3K049dD57jgMBt6za0NRfE8YSlQaEBG1Lj5y/dwGDEJwMzU/XAYRgAW8QQ2Zfh8QWuEnJUtstI9mG0j8Cz0iDWbcTIY9uf+8SZvJrtRgTT/+pkWClT6mPFkGzE6v8k0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778746626; c=relaxed/simple; bh=iqEb8a8kiHrc4y4hobx5FAFml0sfN8naulXRnc5V2vU=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=PD/cLX6Z6iT0RSTHsp+dXA+P2DdDmTpQGF0ZU3KA1JiGky7b4SXewYVkWW6ZwdhV17rKDZEIOy2h3V728jn+2rW2jSOBGOmYiUxL+ieyjo3/ckkao0sJPsjKrhngu1kFZ2P6LKV6pOQpsXtoEAjm8jGaoydMiWMziS2+OzX182g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=v0lPPCkg; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="v0lPPCkg" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778746622; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zLrAoOEPFxwptypqmQTS2ICcy/5N9VlSvuD2zj/07tA=; b=v0lPPCkgev1849GW+OiWliI9YXN1+EVzWIId60Z+uglBAigKo0XkAOcmg4+zbfwEM9ovUe n1ZirusYynvEENdn/xkIkli/HW42I5RUhrEPLZLmywQg6fAgjw1rhGfykOgf1TM6A6ToKH i0ViW3SEoN+yW3QoELP2RdXU0u9VCtU= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.500.181\)) Subject: Re: [PATCH v2 04/69] mm/hugetlb: Initialize gigantic bootmem hugepage struct pages earlier X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Thu, 14 May 2026 16:16:05 +0800 Cc: Muchun Song , Andrew Morton , David Hildenbrand , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , Ackerley Tng , Frank van der Linden , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <19B1C90F-B268-4FA8-BF9E-4B7B6188B908@linux.dev> References: <20260513130542.35604-1-songmuchun@bytedance.com> <20260513130542.35604-5-songmuchun@bytedance.com> To: Oscar Salvador X-Migadu-Flow: FLOW_OUT > On May 14, 2026, at 16:05, Oscar Salvador wrote: >=20 > On Wed, May 13, 2026 at 09:04:32PM +0800, Muchun Song wrote: >> Gigantic bootmem HugeTLB pages are currently initialized from = hugetlb_init(), >> but page_alloc_init_late() runs earlier and walks pageblocks to = determine >> zone contiguity. >>=20 >> If a bootmem HugeTLB region is marked noinit, set_zone_contiguous() = can >> observe still-uninitialized struct pages through = __pageblock_pfn_to_page(). >> This may not trigger an immediate failure, but it can make >> set_zone_contiguous() compute the wrong zone contiguity state. If = extra >> poisoned-page checks are added in this path, such as = PF_POISONED_CHECK() >> in page_zone_id(), it can also trigger an early boot panic. >>=20 >> Initialize gigantic bootmem HugeTLB struct pages from = page_alloc_init_late(), >> before zone contiguity is evaluated, so later page allocator setup = only >> sees valid struct page state. This also makes the initialization = order >> more natural, as struct pages should be initialized before later code >> inspects them. >>=20 >> Fixes: fde1c4ecf916 ("mm: hugetlb: skip initialization of gigantic = tail struct pages if freed by HVO") >> Signed-off-by: Muchun Song >=20 > Acked-by: Oscar Salvador >=20 Thanks. > but >=20 >> --- >> include/linux/hugetlb.h | 5 +++++ >> mm/hugetlb.c | 3 +-- >> mm/mm_init.c | 1 + >> 3 files changed, 7 insertions(+), 2 deletions(-) >>=20 >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h >> index 93418625d3c5..52a2c30f866c 100644 >> --- a/include/linux/hugetlb.h >> +++ b/include/linux/hugetlb.h >> @@ -173,6 +173,7 @@ extern int movable_gigantic_pages __read_mostly; >> extern int sysctl_hugetlb_shm_group __read_mostly; >> extern struct list_head huge_boot_pages[MAX_NUMNODES]; >>=20 >> +void hugetlb_struct_page_init(void); >=20 > we lost the hint that this only takes care of bootmem pages. Right. > So I think hugetlb_bootmem_struct_page_init or something like that = would make > it more clear? Yes. Make sense. Thanks, Muchun >=20 >=20 > --=20 > Oscar Salvador > SUSE Labs