From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-cxl@vger.kernel.org, kernel-team@meta.com,
osalvador@suse.de, akpm@linux-foundation.org, rppt@kernel.org,
mgorman@techsingularity.net, hannes@cmpxchg.org,
vbabka@kernel.org
Subject: Re: [PATCH] mm/mm_init: handle alloc_percpu failure in free_area_init_core_hotplug
Date: Wed, 1 Jul 2026 18:54:52 +0200 [thread overview]
Message-ID: <43b4c503-14ba-4e88-b56c-caf5ef0597de@kernel.org> (raw)
In-Reply-To: <akUszCySPFA7IRlb@gourry-fedora-PF4VCD3F>
On 7/1/26 17:05, Gregory Price wrote:
> On Wed, Jul 01, 2026 at 10:35:41AM +0200, David Hildenbrand (Arm) wrote:
>>
>>> * The node we allocated has no zone fallback lists. For avoiding
>>> diff --git a/mm/mm_init.c b/mm/mm_init.c
>>> index 306ea5c13f54..37fd64ce144d 100644
>>> --- a/mm/mm_init.c
>>> +++ b/mm/mm_init.c
>>> @@ -1536,7 +1536,7 @@ void __init set_pageblock_order(void)
>>> * NOTE: this function is only called during memory hotplug
>>> */
>>> #ifdef CONFIG_MEMORY_HOTPLUG
>>> -void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
>>> +int __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
>>> {
>>> int nid = pgdat->node_id;
>>> enum zone_type z;
>>> @@ -1544,8 +1544,14 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
>>>
>>> pgdat_init_internals(pgdat);
>>>
>>> - if (pgdat->per_cpu_nodestats == &boot_nodestats)
>>> - pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat);
>>> + if (pgdat->per_cpu_nodestats == &boot_nodestats) {
>>> + struct per_cpu_nodestat __percpu *p;
>>> +
>>> + p = alloc_percpu(struct per_cpu_nodestat);
>>> + if (!p)
>>> + return -ENOMEM;
>>> + pgdat->per_cpu_nodestats = p;
>>
>> Is there a need for the temporary variable?
>>
>
> at start:
> pgdat->per_cpu_nodestats = &boot_nodestats
>
> So need a tmp to do the swap/revert/etc
Reviewing too many patches today ... makes sense.
>
>> Also how to handle cleanup on error? Or why can we skip cleanup? (what happens
>> if we get another call to __try_online_node() later?)
>>
>
> -ENOMEM ->
> hotadd_init_pgdat -> NULL
> __try_online_node -> -ENOMEM
> pr_err("Cannot online node %d due to NULL pgdat\n", nid);
> try_online_node -> -ENOMEM
> __add_memory_resource -> error_memblock_remove:
>
> Basically we're left exactly where we were before we made the attempt.
>
> Another call should work just fine after a bunch of dmesg spew.
Okay, so the additional pgdat_init_internals) should be ok.
Makes sense to me, thanks.
--
Cheers,
David
prev parent reply other threads:[~2026-07-01 16:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 21:40 [PATCH] mm/mm_init: handle alloc_percpu failure in free_area_init_core_hotplug Gregory Price
2026-07-01 6:38 ` Mike Rapoport
2026-07-01 15:20 ` Gregory Price
2026-07-01 20:14 ` Mike Rapoport
2026-07-01 8:35 ` David Hildenbrand (Arm)
2026-07-01 15:05 ` Gregory Price
2026-07-01 16:54 ` David Hildenbrand (Arm) [this message]
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=43b4c503-14ba-4e88-b56c-caf5ef0597de@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.