From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 BAA4B175A68 for ; Tue, 2 Jun 2026 14:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780411601; cv=none; b=entX8czcX6OEPZ5M4xsC8wjBbC99RLFZG0kAcBNUM8//sfyTxrx28QUngHqoMNhLTGpOFYPrfsPEWgp0BLXKxezd88hgS/y90Vd7fuKQ41/MVL0UahJUcjP3FaGoa6tAi9144Oj286Q+tAXu9yDSsQgbU9eIjv/Bg6PT8oLRncY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780411601; c=relaxed/simple; bh=wPMaklkf5j1hM11Qb1b1tYEyaWxoYBrdq+MJmwEf6xY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QWdvj/imEgtnzQHLM8fIUQwHBzYIBwO1KzbXhtrGagXME98zBNaaExEDFqK/cyGC2hBCRUwGdjxDQqUY0uDgo5Qu6U5ab4zGYn4pa1MDuw4MYSnu5X++KYF6Lt+ly6vAwbl5pUAXYh8fOHykQ0WpVllpz28ujKjO61F1KcixQts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mM1g+JEX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mM1g+JEX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3811F00893; Tue, 2 Jun 2026 14:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780411600; bh=4NFd70hWGL8P5zEehk7GPp+B6cZq/FHBhT/mSt5ArDw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=mM1g+JEXbWh/t59o/u4O+aWUWSA2HDFoJg1p2byPHhxS/579iO/AQguWyMy9rgWw3 GAbrtIjzEw56ZYFRk6rXc9IVIK+2G1UtX8+ICCujPIHbKOcGccNYDwd8bDct6tHwyQ RFFWwOGRn8YkjljKH2HbwXvhLhQuK7ngENeBSos+e/F0MGOtueJji71Zu1YMS71HiV NKFndrSaeiL9msFB56weG0VNs/tHWybudHZut6ZOOxGrILBaHsSjhKZq/MZzDJTKYT cRnXo5pZwp5JXjwrlNFfBSbLduf+hrV4qETakfA6m00qZFNRgpvdtKCQnTLjUPQiGS OA+BymabXUfRA== Date: Tue, 2 Jun 2026 17:46:31 +0300 From: Mike Rapoport To: Muchun Song Cc: Oscar Salvador , David Hildenbrand , Andrew Morton , Madhavan Srinivasan , Michael Ellerman , Muchun Song , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , "Aneesh Kumar K.V" , linuxppc-dev@lists.ozlabs.org, Mike Kravetz Subject: Re: [PATCH v3 19/19] mm/mm_init: Fold __init_page_from_nid() into __init_deferred_page() Message-ID: References: <20260602101039.1867613-1-songmuchun@bytedance.com> <20260602101039.1867613-20-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: <20260602101039.1867613-20-songmuchun@bytedance.com> On Tue, Jun 02, 2026 at 06:10:39PM +0800, Muchun Song wrote: > __init_page_from_nid() no longer has external users and is only used > locally in mm/mm_init.c under CONFIG_DEFERRED_STRUCT_PAGE_INIT. > > Fold it into its sole caller __init_deferred_page() and remove the > separate helper declaration. > > Signed-off-by: Muchun Song > --- > v2->v3: > - fold __init_page_from_nid() into __init_deferred_page() since it > only has a single caller (suggested by Mike Rapoport) > --- > mm/internal.h | 1 - > mm/mm_init.c | 44 ++++++++++++++++++-------------------------- > 2 files changed, 18 insertions(+), 27 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index 8497673d0ac3..b33fc87e4555 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -1760,7 +1760,6 @@ static inline bool pte_needs_soft_dirty_wp(struct vm_area_struct *vma, pte_t pte > > void __meminit __init_single_page(struct page *page, unsigned long pfn, > unsigned long zone, int nid); > -void __meminit __init_page_from_nid(unsigned long pfn, int nid); > > /* shrinker related functions */ > unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg, > diff --git a/mm/mm_init.c b/mm/mm_init.c > index 41b83dd18c01..f1bbf3b9a321 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -688,31 +688,6 @@ static __meminit void pageblock_migratetype_init_range(unsigned long pfn, > } > #endif > > -/* > - * Initialize a reserved page unconditionally, finding its zone first. > - */ > -void __meminit __init_page_from_nid(unsigned long pfn, int nid) > -{ > - pg_data_t *pgdat; > - int zid; > - > - pgdat = NODE_DATA(nid); > - > - for (zid = 0; zid < MAX_NR_ZONES; zid++) { > - struct zone *zone = &pgdat->node_zones[zid]; > - > - if (zone_spans_pfn(zone, pfn)) > - break; > - } > - __init_single_page(pfn_to_page(pfn), pfn, zid, nid); > - > - if (pageblock_aligned(pfn)) { > - enum migratetype mt = > - kho_scratch_migratetype(pfn, MIGRATE_MOVABLE); > - init_pageblock_migratetype(pfn_to_page(pfn), mt, false); > - } > -} > - > #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT > static inline void pgdat_set_deferred_range(pg_data_t *pgdat) > { > @@ -771,10 +746,27 @@ defer_init(int nid, unsigned long pfn, unsigned long end_pfn) > > static void __meminit __init_deferred_page(unsigned long pfn, int nid) > { > + pg_data_t *pgdat; > + int zid; > + > if (early_page_initialised(pfn, nid)) > return; > > - __init_page_from_nid(pfn, nid); > + pgdat = NODE_DATA(nid); Nit: we can initialize pgdat at declaration line, other than that Reviewed-by: Mike Rapoport (Microsoft) > + > + for (zid = 0; zid < MAX_NR_ZONES; zid++) { > + struct zone *zone = &pgdat->node_zones[zid]; > + > + if (zone_spans_pfn(zone, pfn)) > + break; > + } > + __init_single_page(pfn_to_page(pfn), pfn, zid, nid); > + > + if (pageblock_aligned(pfn)) { > + enum migratetype mt = > + kho_scratch_migratetype(pfn, MIGRATE_MOVABLE); > + init_pageblock_migratetype(pfn_to_page(pfn), mt, false); > + } > } > #else > static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {} > -- > 2.54.0 > > -- Sincerely yours, Mike.