From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8E8A3366823 for ; Tue, 28 Apr 2026 07:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777360558; cv=none; b=a0cvURznEybtS6wY/wVqCZINTmni3FDJ4r+6I1JoOQcrZ/+L2WrOM/u999CTv5PP745Hd7bExp9d8QlsShvCBpXxW05qYbNG7/28j92jO5faIcdvVah5cz8YLCmKwzQPiPuM0L8t2kRMxV3LooOnRDjzxXcYOapcHnB3PunNtMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777360558; c=relaxed/simple; bh=YiFruMllP7Hsn3RHqR+ow3axxP/rEMVw7OY4f6H0hUA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SXnGaqqdSIphjJ9/IxD0ZhscZRPUPkO4LRsphO/N3mZ7vA1zGXK+6Zaz3F6fZSvAHSCUdan44wOkqDwY5ZKxlyVlEe8Ipvx3hVcrmEAsogAOTfZNlRWhOwssiqvI9QkBaPsgPKRePhCxRvyWskQv/P4uNsrvO/ewqtrd5PmAw1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J7emyAvV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J7emyAvV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57B73C2BCAF; Tue, 28 Apr 2026 07:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777360558; bh=YiFruMllP7Hsn3RHqR+ow3axxP/rEMVw7OY4f6H0hUA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J7emyAvVkk5SF6YOCLb8Y6pqahYtojSzc7QFL7eGIX96o8UFPF7U8LVVpvE0x9Mk7 Ty0vbdH2dMMfYs2hMMMhiZn/zWghIbN4G3dIE0Jl6pW7My2PDE+h1b25J8vIHXxvGP kfv7o1zD5vW7RJCpOIHOEMo49bkkt4KWfvYPK4a2u9AXIUAouI6uvxRYz1RxLIwebM JUjL7+O8rG78bTKN6CjujeXTzjkKsEdbigh7zQz37K4Jcens/Wi4hegeBHcLeKudHj 7svjSLPqxKPID34kBHjSqsByE0hxRF2eFGqcsr+QIx6tzWdJ95jOHn8IGasqmiROzI PCudJwjRJIc8g== Date: Tue, 28 Apr 2026 09:15:48 +0200 From: Mike Rapoport To: Muchun Song Cc: Andrew Morton , David Hildenbrand , Muchun Song , Oscar Salvador , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/49] mm: defer sparse_init() until after zone initialization Message-ID: References: <20260405125240.2558577-1-songmuchun@bytedance.com> <20260405125240.2558577-12-songmuchun@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260405125240.2558577-12-songmuchun@bytedance.com> On Sun, Apr 05, 2026 at 08:52:02PM +0800, Muchun Song wrote: > According to the comment of free_area_init(), its main goal is to > initialise all pg_data_t and zone data. However, sparse_init() and > memmap_init() are aimed at allocating vmemmap pages and initializing > struct page respectively, which differs from the goal of free_area_init(). > Therefore, it is reasonable to move them out of free_area_init(). > > Call sparse_init() after free_area_init() to guarantee that zone data > structures are available when sparse_init() executes. This change is a > prerequisite for integrating vmemmap initialization steps and allows > sparse_init() to safely access zone information if needed (e.g. HVO case). > > Also, move hugetlb reservation functions (hugetlb_cma_reserve() and > hugetlb_bootmem_alloc()) to be after free_area_init(). This allows > hugetlb reservation to access zone information to ensure that contiguous > pages are not allocated across zone boundaries, which simplifies the > hugetlb code. So this is a preparation for subsequent changes. > > Signed-off-by: Muchun Song > --- > mm/mm_init.c | 15 ++++++++------- > mm/sparse.c | 3 --- > 2 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index c7f91dc2e5b5..5fe0a7e66775 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -406,9 +406,6 @@ void __init sparse_init(void) > pnum_begin = first_present_section_nr(); > nid_begin = sparse_early_nid(__nr_to_section(pnum_begin)); > > - /* Setup pageblock_order for HUGETLB_PAGE_SIZE_VARIABLE */ > - set_pageblock_order(); > - This does not seem related to this patch. Otherwise Reviewed-by: Mike Rapoport (Microsoft) > for_each_present_section_nr(pnum_begin + 1, pnum_end) { > int nid = sparse_early_nid(__nr_to_section(pnum_end)); > > -- > 2.20.1 > -- Sincerely yours, Mike.