Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>, linux-mm@kvack.org
Subject: Re: [PATCH] mm/mm_init: remove unnecessary initialization of pgdat->per_cpu_nodestats
Date: Wed, 29 Jul 2026 13:27:45 -0700	[thread overview]
Message-ID: <20260729132745.9d42a13e614be2e18c5988ba@linux-foundation.org> (raw)
In-Reply-To: <20260729155143.177790-1-ekffu200098@gmail.com>

On Thu, 30 Jul 2026 00:51:15 +0900 Sang-Heon Jeon <ekffu200098@gmail.com> wrote:

> free_area_init_node() sets pgdat->per_cpu_nodestats to NULL and later
> calls free_area_init_core(), which unconditionally overwrites it with
> &boot_nodestats. Nothing reads the field in between, so the store has
> no effect.
> 
> Remove unnecessary initialization. No functional change.
> 
> ...
>
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1722,7 +1722,6 @@ static void __init free_area_init_node(int nid)
>  
>  	pgdat->node_id = nid;
>  	pgdat->node_start_pfn = start_pfn;
> -	pgdat->per_cpu_nodestats = NULL;
>  
>  	if (start_pfn != end_pfn) {
>  		pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,

Looks OK, thanks.  Although this statement is "free" in __init code and
its removal does make the code that bit harder to follow.

Possibly *pgdat was zeroed out anyway, I got bored figuring that out. 
The memblock_alloc_range_nid() kerneldoc is silent on the state of the
returned memory but I spy a kzalloc_node() in there.


  reply	other threads:[~2026-07-29 20:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 15:51 [PATCH] mm/mm_init: remove unnecessary initialization of pgdat->per_cpu_nodestats Sang-Heon Jeon
2026-07-29 20:27 ` Andrew Morton [this message]
2026-07-30  6:58   ` Mike Rapoport
2026-07-30  7:06 ` Mike Rapoport

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=20260729132745.9d42a13e614be2e18c5988ba@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ekffu200098@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=rppt@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