From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795981816; b=U7SHsYESCcUqmi9Bk2Of5uypO6nVR8DQGdsE/46g1VYauSlAZuSjK0vCD99VBH9AIbnB knKv5IvVDG77qOhEsISITkjRQz95k5VqfEq/Ns+fVc49CaY8VoE+RNB/8R4q5jLXjYKtc M1YUxcM/n9J2JUX8Qv5sqy/4JuEsud3DqRUI5p94pnBkniGBH+PCK0qRN2AV91oXP0UcZ 3lpTP3/KF76uFYM8UF5KlmonC9I4Py5KsYaTVXdm/IsHhvf9olOYtoiAixIKNrZ+Nydw7 0Di4ncv/i5spdod294f0UkBD2dhwhutgkFFB+aQ+8ymro+rb9ia/KUzjW4UIgvlCnRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795981816; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hEaYUjva22uY88tUdEsSoXel3bQogrGzsAzmZuq68lI=; b=CqH0FhjX/ssRkQP9d/oJwMWMAWvg2TkySh5VITgDCPevtJmzv5bjWi0qKfvgj5ERM+lA FyJN6SbkXJIZ0EWAsXFMMpP1KLnMCU/fsm+lc9VQ3dp9lwzMdnhjg58dbr4B5QgWeC4KK NwftZSkADDsIWKGR7yCCZEgZP/XP/mLwPszp/uDJzihGThhkIOItiuXt6PtaP2R7IYYh2 GrPt0WgtlHsZawbODmvjbpqqb+bEYv5fbGYtwHCn23/Oirn1wmYtvWZTK/MO/cXZFbMWx Ij1W9TgJs9ho3yR+nr77RzeovDg2kNmyZjqm81Fk/vJXQzhhpdm3dSQ3joibx1pTHmw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IopLFxyB; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96279606A31C for ; Sun, 29 Nov 2026 19:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IopLFxyB 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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.