Re: [PATCH 1/1] x86/mm: fix spurious warning on __add_pages() failure
From: Muchun Song
Date: Thu Oct 01 2026 - 05:24:04 EST
> On Oct 1, 2026, at 16:15, Lance Yang <lance.yang@xxxxxxxxx> wrote:
>
> __add_pages() can fail if we run out of memory. The caller already
> handles that, so we shouldn't WARN_ON_ONCE() just because an allocation
> failed.
>
> Let's return the error instead, and only update the end-of-memory
> variables after __add_pages() succeeds.
>
> Fixes: 10f22dde556d ("x86: arch/x86/mm/init_64.c printk fixes")
> Reported-by: David Hildenbrand <david@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/d4fac8af-fd71-47a2-bfe9-3c6559b92209@xxxxxxxxxx/
> Suggested-by: Muchun Song <muchun.song@xxxxxxxxx>
> Link: https://lore.kernel.org/all/203892F4-B04A-4F69-A1B3-DC1619176C67@xxxxxxxxx/
> Signed-off-by: Lance Yang <lance.yang@xxxxxxxxx>
I noticed that __add_pages() already reports invalid parameters where
appropriate, while errors such as -ENOMEM can legitimately occur and
are propagated to the caller. Therefore, the additional
WARN_ON_ONCE(ret) in add_pages() seems unnecessary to me.
The change looks reasonable.
Acked-by: Muchun Song <muchun.song@xxxxxxxxx>