[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bA-pzGO83wi63A1QFe=u33HXKTw6Po7j7W0PN4dK7WG9A@mail.gmail.com>
Date: Thu, 22 Jan 2026 13:18:04 -0500
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Evangelos Petrongonas <epetron@...zon.de>
Cc: Mike Rapoport <rppt@...nel.org>, Pratyush Yadav <pratyush@...nel.org>,
Alexander Graf <graf@...zon.com>, Jason Miu <jasonmiu@...gle.com>, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, linux-mm@...ck.org, nh-open-source@...zon.com
Subject: Re: [PATCH v2] kho: skip memoryless NUMA nodes when reserving scratch areas
On Tue, Jan 20, 2026 at 12:59 PM Evangelos Petrongonas
<epetron@...zon.de> wrote:
>
> kho_reserve_scratch() iterates over all online NUMA nodes to allocate
> per-node scratch memory. On systems with memoryless NUMA nodes (nodes
> that have CPUs but no memory), memblock_alloc_range_nid() fails because
> there is no memory available on that node. This causes KHO initialization
> to fail and kho_enable to be set to false.
>
> Some ARM64 systems have NUMA topologies where certain nodes contain only
> CPUs without any associated memory. These configurations are valid and
> should not prevent KHO from functioning.
>
> Fix this by only counting nodes that have memory (N_MEMORY state) and
> skip memoryless nodes in the per-node scratch allocation loop.
>
> Signed-off-by: Evangelos Petrongonas <epetron@...zon.de>
> ---
> v2:
> - Removed kho_mem_nodes_count in favour of nodes_weight(nodes_state[N_MEMORY])
> - Use for_each_node_state(nid, N_MEMORY) to loop over nodes that are both
> online and have memory.
> TIL: Nodes in N_MEMORY are a subset of those that are online. Thanks Mike :)
>
> kernel/liveupdate/kexec_handover.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 9dc51fab604f..979ebaf015bf 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -643,7 +643,7 @@ static void __init kho_reserve_scratch(void)
> scratch_size_update();
>
> /* FIXME: deal with node hot-plug/remove */
> - kho_scratch_cnt = num_online_nodes() + 2;
> + kho_scratch_cnt = nodes_weight(node_states[N_MEMORY]) + 2;
> size = kho_scratch_cnt * sizeof(*kho_scratch);
> kho_scratch = memblock_alloc(size, PAGE_SIZE);
> if (!kho_scratch)
> @@ -673,7 +673,11 @@ static void __init kho_reserve_scratch(void)
> kho_scratch[i].size = size;
> i++;
>
> - for_each_online_node(nid) {
> + /*
> + * Loop over nodes that have both memory and are online. Skip
> + * memoryless nodes, as we can not allocate scratch areas there.
> + */
> + for_each_node_state(nid, N_MEMORY) {
> size = scratch_size_node(nid);
> addr = memblock_alloc_range_nid(size, CMA_MIN_ALIGNMENT_BYTES,
> 0, MEMBLOCK_ALLOC_ACCESSIBLE,
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.com>
Powered by blists - more mailing lists