From: Mike Rapoport <rppt@kernel.org>
To: Chris Down <chris@chrisdown.name>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
David Hildenbrand <david@kernel.org>
Subject: Re: [PATCH 2/2] kho: count bootmem in CmaTotal
Date: Sun, 29 Nov 2026 21:50:10 +0200 [thread overview]
Message-ID: <awyB8ggE70UIl_1F@kernel.org> (raw)
In-Reply-To: <87b6c744e6413d49872df0ccbc8798c409df51b6.1795928397.git.chris@chrisdown.name>
Hi Chris,
On Sat, Nov 28, 2026 at 09:01:51PM -0800, Chris Down wrote:
> /proc/meminfo shows totalcma_pages as CmaTotal, but cma_new_area(),
> cma_drop_area() and cma_activate_area() only update it for their own
> areas. As such, bootmem is never in CmaTotal. Bootmem pageblocks are
> MIGRATE_CMA though, so their free pages are in CmaFree, and without any
> other CMA areas CmaFree ends up larger than CmaTotal. For example, with
> 4 GiB over two nodes and kho_bootmem=32M,512M,256M, which is 1056 MiB of
> bootmem:
>
> cold boot after KHO kexec
> CmaTotal 0 kB 0 kB
> CmaFree 1071076 kB 988188 kB
Can you please add a table with counts after the change?
> Let's add bootmem to totalcma_pages wherever kho_init() adds it to
> zone->cma_pages, that is, after init_cma_reserved_pageblock() on a cold
> boot, and in kho_account_incoming_bootmem() on a KHO boot. With this
> applied, CmaTotal has bootmem accounted correctly after both boots.
> This happens long after mem_init_print_info(), so the "Memory:" boot
> line doesn't change.
>
> Fixes: 3dc92c311498 ("kexec: add Kexec HandOver (KHO) generation helpers")
> Signed-off-by: Chris Down <chris@chrisdown.name>
> ---
> kernel/liveupdate/kexec_handover.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 7cc87338df24..8efef4a37991 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1886,6 +1886,7 @@ static void __init kho_account_incoming_bootmem(void)
> continue;
>
> page_zone(page)->cma_pages += pageblock_nr_pages;
> + totalcma_pages += pageblock_nr_pages;
> }
> }
> }
> @@ -1950,6 +1951,7 @@ static __init int kho_init(void)
> for (pfn = base_pfn; pfn < base_pfn + count;
> pfn += pageblock_nr_pages)
> init_cma_reserved_pageblock(pfn_to_page(pfn));
> + totalcma_pages += count;
> }
>
> WARN_ON_ONCE(kho_debugfs_blob_add(&kho_out.dbg, "fdt",
> --
> 2.56.1
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-11-29 19:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 5:01 [PATCH 0/2] mm, kho: count KHO bootmem in CmaTotal and in zoneinfo's cma Chris Down
2026-11-29 5:01 ` [PATCH 1/2] kho: count bootmem in zoneinfo's cma after a KHO kexec Chris Down
2026-11-29 19:48 ` Mike Rapoport
2026-11-29 5:01 ` [PATCH 2/2] kho: count bootmem in CmaTotal Chris Down
2026-11-29 19:50 ` Mike Rapoport [this message]
2026-11-29 5:11 ` [PATCH 0/2] mm, kho: count KHO bootmem in CmaTotal and in zoneinfo's cma sashiko-bot
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=awyB8ggE70UIl_1F@kernel.org \
--to=rppt@kernel.org \
--cc=chris@chrisdown.name \
--cc=david@kernel.org \
--cc=graf@amazon.com \
--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 \
/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.