From: sashiko-bot@kernel.org
To: "Sourabh Jain" <sourabhjain@linux.ibm.com>
Cc: "Pasha Tatashin" <pasha.tatashin@soleen.com>,
linux-mm@kvack.org, "Mike Rapoport" <rppt@kernel.org>,
kexec@lists.infradead.org,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
"George Guo" <guodongtai@kylinos.cn>,
"Pratyush Yadav" <pratyush@kernel.org>,
linux-kernel@vger.kernel.org,
"Andrew Morton" <akpm@linux-foundation.org>,
"Alexander Graf" <graf@amazon.com>
Subject: Re: [PATCH] kho: fix global scratch size calculation
Date: Tue, 22 Sep 2026 13:27:38 +0000 [thread overview]
Message-ID: <20260922132738.B15EB1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922131217.698809-1-sourabhjain@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kho: lowmem scratch exhaustion due to missing node-specific lowmem reservations
--
commit 45b67db1813edaa6fb1bdfe7033f0598a814cd63
Author: Sourabh Jain <sourabhjain@linux.ibm.com>
kho: fix global scratch size calculation
This commit updates the scratch size calculations to correctly distinguish
between memory reserved for a specific NUMA node and memory reserved with
NUMA_NO_NODE. It introduces memblock_reserved_size_nid() to calculate
reserved memory based on reservation type and NUMA node, fixing an issue
where per-node reservations were incorrectly included in the global scratch
allocation.
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 7c4d86daf86d5..dc809e1e768c0 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
[ ... ]
> @@ -787,17 +787,17 @@ static void __init scratch_size_update(void)
> if (scratch_scale) {
> phys_addr_t size;
>
> - size = memblock_reserved_kern_size(ARCH_LOW_ADDRESS_LIMIT,
> - NUMA_NO_NODE);
> - size -= memblock_reserved_hugetlb_size(ARCH_LOW_ADDRESS_LIMIT,
> - NUMA_NO_NODE);
> + size = memblock_reserved_size_nid(ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE,
> + MEMBLOCK_RSRV_KERN);
[Severity: High]
Does checking NUMA_NO_NODE here exclude node-specific lowmem reservations
(like node-bound DMA pools) from the lowmem scratch size calculation?
If the successor kernel requires lowmem for these node-specific reservations
during early boot, could shrinking the global lowmem scratch memory lead to
memblock allocation failures and a panic?
> + size -= memblock_reserved_size_nid(ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE,
> + MEMBLOCK_RSRV_HUGETLB);
> size = size * scratch_scale / 100;
> scratch_size_lowmem = size;
[ ... ]
> @@ -815,11 +815,11 @@ static phys_addr_t __init scratch_size_node(int nid)
> phys_addr_t size;
>
> if (scratch_scale) {
> - size = memblock_reserved_kern_size(MEMBLOCK_ALLOC_ANYWHERE,
> - nid);
> + size = memblock_reserved_size_nid(MEMBLOCK_ALLOC_ANYWHERE, nid,
> + MEMBLOCK_RSRV_KERN);
[Severity: High]
Are the node-specific lowmem reservations that were excluded from
scratch_size_lowmem now being counted here instead? Since this counts
with MEMBLOCK_ALLOC_ANYWHERE, will these reservations potentially be satisfied
using scratch memory in highmem?
If the successor kernel restricts its memblock allocations to
MEMBLOCK_KHO_SCRATCH regions, won't it be unable to recreate its
node-specific lowmem reservations if the per-node scratch memory was placed
in highmem?
> /* Do not count HugeTLB pages. */
> - size -= memblock_reserved_hugetlb_size(MEMBLOCK_ALLOC_ANYWHERE,
> - nid);
> + size -= memblock_reserved_size_nid(MEMBLOCK_ALLOC_ANYWHERE, nid,
> + MEMBLOCK_RSRV_HUGETLB);
> size = size * scratch_scale / 100;
> } else {
> size = scratch_size_pernode;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922131217.698809-1-sourabhjain@linux.ibm.com?part=1
prev parent reply other threads:[~2026-09-22 13:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 13:12 Sourabh Jain
2026-09-22 13:27 ` sashiko-bot [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=20260922132738.B15EB1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=graf@amazon.com \
--cc=guodongtai@kylinos.cn \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=ritesh.list@gmail.com \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sourabhjain@linux.ibm.com \
/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
all inboxes | Powered by JetHome®