/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 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 --- 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