From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E40A606A329 for ; Sun, 29 Nov 2026 19:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=UBWf3d2B; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IopLFxyB DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=hEaYUjva22uY88tUdEsSoXel3bQogrGzsAzmZuq68lI=; b=UBWf3d2BaZQDoDkJbmYr0hAWYL S74wE4ddQh4UOGzFpWtJFRURVwCJCnw89l1KPyuWJ2PaKwE0r6ctWNNZoL3DcgFTGw4eawYL93uUY kqBIwIS26kcBrICjYWQwkEgAXDbbNe5QlnJCh2WlkDIvJKOZ0j1uV2k2ghWpkJSE3GwJfVdlq1+rE uhxvCfH/yXEuK7zvPCUlGZrhT2yL3GV483qT60MnqOh8ZNIw7C5o5U3A/sm0mWQm3x0kLJZEjRBCq K4aQlTLZOUoYOq5mYxCsxaJhusgHYt9oHqs/UB+4Vz4Ek+bdW/4BDd/vfypgWJC9Q3cxNvNvYog1g d2CBRyiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXkuh-00000002QLm-0NpH; Sun, 29 Nov 2026 19:50:19 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXkuf-00000002QLe-2bJf for kexec@lists.infradead.org; Sun, 29 Nov 2026 19:50:17 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id BACE46120B; Sun, 29 Nov 2026 19:50:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8435F1F00896; Sun, 29 Nov 2026 19:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795981816; bh=hEaYUjva22uY88tUdEsSoXel3bQogrGzsAzmZuq68lI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=IopLFxyBRY1D4XyQG/MWX9mShEzirV7W3fHWxlbwOw31IwT11K0WvY2nenqT+jBQt 0038tEo6NoAkTphWF1Her4Hodi+TdUtLWP/0kg0C08BXeFJfRgY+a94v8L2QwoUIzV 67sgB+XZYrYZZ/cF6kaI6ZWR4Hglcno5/WF9iojv8Ye/Sf2LHa+3PzAWX13mDseBpS KONy+8VZfsvzJEMklKjDAm5FfaFrjQ+jVqy6iG7Ra7avHaGtA0D62Y5n2YYIiQtO0M 0ntaf/oeqE7JGdTncZiboFivYzIL3aeDlKSHkQH7N6kwyJVn20PESHfLQMZUt8Yqe1 Y+JdwcwauWFOQ== Date: Sun, 29 Nov 2026 21:50:10 +0200 From: Mike Rapoport To: Chris Down Cc: Pasha Tatashin , Pratyush Yadav , Alexander Graf , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH 2/2] kho: count bootmem in CmaTotal Message-ID: References: <87b6c744e6413d49872df0ccbc8798c409df51b6.1795928397.git.chris@chrisdown.name> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87b6c744e6413d49872df0ccbc8798c409df51b6.1795928397.git.chris@chrisdown.name> X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 > --- > 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.