From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 4041D7262B for ; Wed, 29 Apr 2026 03:03:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777431812; cv=none; b=lBLC+awiZkPUMMigIWTe2+ctxp0hjhyp8bg0/PeIQb6uv+5yNPddwDyqQkmPwBXraS3l1WZ7olnopucC1UGPx0EKKpgMjHa6bOFU3rjKK0T1TKusvy5u80KIIXu3x0c6YPAg4fYpC8LwQa2f0KvkljfpcQxXLS7MhAjWkp+rGGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777431812; c=relaxed/simple; bh=Yjy/SWO23ThUklV9XMIOQIXkeioA7br8gJqLFa+/3NE=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=bNZhTUKYQEX35nLk/jvfvpcWFHMsnpfhqcvDfgnGGp2ea6NiBGALzqZhF29nkNKMw1Pl80kwIAMsZ15Xpk8vuzxHDfaWx2y/gG8HGWdoTafS1VMGw7b7oVzIp8IBzv0BLOk9URxoCMRIFFBd5NyXiBTWZM+E8RTwAP9CKMnKRpA= 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=DGEDJbIp; arc=none smtp.client-ip=91.218.175.184 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="DGEDJbIp" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777431808; 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=rVdIF5xMMbMuztmqCdOg6Gne4HRwdJsr6QDFaBOJNgA=; b=DGEDJbIpy7JGrpJ59uRvmyWQ/+oc4LxI28LHP8B9Ra69Qv+7lS7boZ1Xzep4QMP9B6i/OW BFhKEhdpsJ6o+T2i8BGqENxPbqRMQh1DnhZg2CUpl2lTelQMthpw207HvXyrmA10mtWizu UQzVlpvn0F4A0q5MBdSB0nfKcttgSTE= 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 11/49] mm: defer sparse_init() until after zone initialization X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Wed, 29 Apr 2026 11:02:42 +0800 Cc: Muchun Song , Andrew Morton , David Hildenbrand , 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 Content-Transfer-Encoding: 7bit Message-Id: References: <20260405125240.2558577-1-songmuchun@bytedance.com> <20260405125240.2558577-12-songmuchun@bytedance.com> To: Mike Rapoport X-Migadu-Flow: FLOW_OUT > On Apr 28, 2026, at 15:15, Mike Rapoport wrote: > > 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 Right. I will move this to the following patch as you suggested. > > Reviewed-by: Mike Rapoport (Microsoft) Thanks. > >> 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.