Re: [PATCH] arch_numa: remove redundant nodemask clears in numa_init()
From: Andrew Morton
Date: Wed Jun 24 2026 - 23:40:39 EST
On Thu, 18 Jun 2026 01:39:19 +0900 Sang-Heon Jeon <ekffu200098@xxxxxxxxx> wrote:
> numa_init() clears numa_nodes_parsed, node_possible_map and
> node_online_map, then calls numa_memblks_init(), which clears the same
> nodemasks. Nothing uses them in between.
>
> These clears have been redundant since commit 767507654c22 ("arch_numa:
> switch over to numa_memblks") made numa_init() use numa_memblks_init().
>
> No functional change.
>
> ...
>
> --- a/drivers/base/arch_numa.c
> +++ b/drivers/base/arch_numa.c
> @@ -231,10 +231,6 @@ static int __init numa_init(int (*init_func)(void))
> {
> int ret;
>
> - nodes_clear(numa_nodes_parsed);
> - nodes_clear(node_possible_map);
> - nodes_clear(node_online_map);
> -
> ret = numa_memblks_init(init_func, /* memblock_force_top_down */ false);
> if (ret < 0)
> goto out_free_distance;
hm, OK, thanks.
A couple of driveby questions:
Are the other nodes_clear() calls are needed - aren't these things
zeroed when the kernel is loaded?
Also,
#define node_possible_map node_states[N_POSSIBLE]
...
nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
[N_POSSIBLE] = NODE_MASK_ALL,
why do we carefully initialize node_possible_map at compile-time then
zero it within __init code?