From: Mike Rapoport <rppt@kernel.org>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Muchun Song <muchun.song@linux.dev>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH v3 19/19] mm/mm_init: Fold __init_page_from_nid() into __init_deferred_page()
Date: Tue, 2 Jun 2026 17:46:31 +0300 [thread overview]
Message-ID: <ah7sx7eh1JQctWYO@kernel.org> (raw)
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 <songmuchun@bytedance.com>
> ---
> 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) <rppt@kernel.org>
> +
> + 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.
next prev parent reply other threads:[~2026-06-02 14:46 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 10:10 [PATCH v3 00/19] mm: Refactor bootmem gigantic hugepage allocation Muchun Song
2026-06-02 10:10 ` [PATCH v3 01/19] mm/hugetlb: Fix boot panic with CONFIG_DEBUG_VM and HVO bootmem pages Muchun Song
2026-06-02 10:10 ` [PATCH v3 02/19] mm/hugetlb_vmemmap: Fix __hugetlb_vmemmap_optimize_folios() Muchun Song
2026-06-02 10:10 ` [PATCH v3 03/19] powerpc/mm: Fix wrong addr_pfn tracking in compound vmemmap population Muchun Song
2026-06-03 14:36 ` Ritesh Harjani
2026-06-02 10:10 ` [PATCH v3 04/19] mm/hugetlb: Initialize gigantic bootmem hugepage struct pages earlier Muchun Song
2026-06-02 10:10 ` [PATCH v3 05/19] mm/mm_init: Simplify deferred_free_pages() migratetype init Muchun Song
2026-06-02 10:10 ` [PATCH v3 06/19] mm/sparse: Panic on memmap and usemap allocation failure Muchun Song
2026-06-02 10:10 ` [PATCH v3 07/19] mm/sparse: Move subsection_map_init() into sparse_init() Muchun Song
2026-06-02 10:10 ` [PATCH v3 08/19] mm/mm_init: Defer sparse_init() until after zone initialization Muchun Song
2026-06-02 10:10 ` [PATCH v3 09/19] mm/mm_init: Defer hugetlb reservation " Muchun Song
2026-06-02 10:10 ` [PATCH v3 10/19] mm/mm_init: Remove set_pageblock_order() call from sparse_init() Muchun Song
2026-06-02 10:10 ` [PATCH v3 11/19] mm/sparse: Move sparse_vmemmap_init_nid_late() into sparse_init_nid() Muchun Song
2026-06-02 10:10 ` [PATCH v3 12/19] mm/hugetlb_cma: Validate hugetlb CMA range by zone at reserve time Muchun Song
2026-06-02 10:10 ` [PATCH v3 13/19] mm/hugetlb: Refactor early boot gigantic hugepage allocation Muchun Song
2026-06-02 10:10 ` [PATCH v3 14/19] mm/hugetlb: Free cross-zone bootmem gigantic pages after allocation Muchun Song
2026-06-02 15:41 ` Mike Rapoport
2026-06-03 2:53 ` Muchun Song
2026-06-02 10:10 ` [PATCH v3 15/19] mm/hugetlb_vmemmap: Move bootmem HVO setup to early init Muchun Song
2026-06-02 15:41 ` Mike Rapoport
2026-06-03 2:42 ` Muchun Song
2026-06-03 12:02 ` Usama Arif
2026-06-03 12:24 ` Muchun Song
2026-06-03 12:35 ` Usama Arif
2026-06-02 10:10 ` [PATCH v3 16/19] mm/hugetlb: Remove obsolete bootmem cross-zone checks Muchun Song
2026-06-02 15:41 ` Mike Rapoport
2026-06-02 10:10 ` [PATCH v3 17/19] mm/sparse-vmemmap: Remove sparse_vmemmap_init_nid_late() Muchun Song
2026-06-02 15:41 ` Mike Rapoport
2026-06-02 10:10 ` [PATCH v3 18/19] mm/hugetlb: Remove unused bootmem cma field Muchun Song
2026-06-02 15:41 ` Mike Rapoport
2026-06-03 2:41 ` Muchun Song
2026-06-02 10:10 ` [PATCH v3 19/19] mm/mm_init: Fold __init_page_from_nid() into __init_deferred_page() Muchun Song
2026-06-02 14:46 ` Mike Rapoport [this message]
2026-06-02 15:41 ` Mike Rapoport
2026-06-03 2:39 ` Muchun Song
2026-06-02 10:34 ` [PATCH v3 00/19] mm: Refactor bootmem gigantic hugepage allocation Oscar Salvador (SUSE)
2026-06-02 12:01 ` Muchun Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ah7sx7eh1JQctWYO@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljs@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mike.kravetz@oracle.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=npiggin@gmail.com \
--cc=osalvador@suse.de \
--cc=ritesh.list@gmail.com \
--cc=songmuchun@bytedance.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox