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 9C4D7606A32F for ; Wed, 2 Dec 2026 07:26:59 +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=38Eh1l8/; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OcwOiD/u 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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=giQ2/CIzZrWkAXSnq7RtoKJUh24ugGTMdfD/pmXnEBQ=; b=38Eh1l8/c1eZnNpghPp4jplP/k izBDKuQ9SXorTEr1HLGYIcHJ4PEfXa1yGI/p3MaMT58rIhBnbz1BsLiIJkP9dnFonedMYmGQgngT5 HzN9AALTzgUfzs5FE6UChAo6pljSRYetT8I1k0fLma9LcEF1D+k6K/xu4iUuWRknO0RR0gIGeCSi9 oGD5UkfcEqulAqOsPgvXZrLmGmmrKcZq5SRwA01buk+QHeJ1c+nPI6pGa+V+swRMnhpB12r5PPnGI bjWlVJjcjYtt1lhxL1ILa9bBPkkpZjFeOiq3TrhxCVHzUZpH+MmKiiA1euxK1CnN8rk6A5jI6ZI45 aYVLW3xQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYejr-0000000AVIr-0Svh; Wed, 02 Dec 2026 07:26:51 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYejq-0000000AVIc-0c3n; Wed, 02 Dec 2026 07:26:50 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 237B940EAE; Wed, 2 Dec 2026 07:26:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FF201F000C1; Wed, 2 Dec 2026 07:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796196409; bh=giQ2/CIzZrWkAXSnq7RtoKJUh24ugGTMdfD/pmXnEBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=OcwOiD/ub5MzaTRSolKWSptoQ91kQ4MDFcIKo4RCFyYnj63QJS7NhvLaoTN94opEq rW/PWP12iR8Ops7OHok5woUfq4ZaWQ1/c6wI/IEaLvrJ3Xkr1T359oAGem1yxu519o eSAtTUk/DY3ObAIijV6g1dRRHFPGB5SES3veEMvSViiTPth16QBrN6Xa9VYHKTcKWL UhRIYXzFCaAd58PDKkSRZDSuWp/9V1LTAzFaxIqheZjb+r9q64P+UeiYsy0xldgGSB TBMuzB9TI1mf0PBR0Dtg+yG8Emb6iQB8zFc/WCbSdQ74Rv/aUE3iFAvyufq+/WuWgz FFB7qNPUYRhsQ== Date: Wed, 2 Dec 2026 09:26:34 +0200 From: Mike Rapoport To: Yang Shi Cc: linux-mm@kvack.org, Adrian =?utf-8?Q?Barna=C5=9B?= , Alexander Gordeev , Andrew Morton , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Brendan Jackman , Catalin Marinas , Dave Hansen , David Hildenbrand , Gerald Schaefer , Heiko Carstens , Huacai Chen , Ingo Molnar , Kevin Brodsky , "Liam R. Howlett" , Lorenzo Stoakes , Madhavan Srinivasan , Michal Hocko , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Russell King , Suren Baghdasaryan , Thomas Gleixner , Vasily Gorbik , Vlastimil Babka , Will Deacon , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, x86@kernel.org Subject: Re: [PATCH RFC v2 52/54] arm64: count the mappings of the linear map Message-ID: References: <20261126-generic-set-memory-v0-1-v2-0-723f1e33c3d8@kernel.org> <20261126-generic-set-memory-v0-1-v2-52-723f1e33c3d8@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 Yang, On Tue, Dec 01, 2026 at 12:43:44PM -0800, Yang Shi wrote: > On Thu, Nov 26, 2026 at 3:23 AM Mike Rapoport (Microsoft) > wrote: > > > > The core keeps a counter of the direct map entries at every page table > > level. A split moves an entry to the level below and counts a > > direct_map_level2_splits or direct_map_level3_splits event in /proc/vmstat. > > The counters start from what the architecture mapped. > > > > arm64 never counts its linear map, so the core finds no large pages to take > > a split from, and the split events stay at zero. > > > > Count the linear map when it is created at boot and on memory hotplug, and > > when memory is removed. map_mem() maps the kernel alias and the KFENCE pool > > before it maps all of memory over them, so only the entries that were empty > > count. The split of the linear map at boot, when not all CPUs support > > BBML3, bypasses the core, so count its splits as well. > > > > Report the counters in /proc/meminfo. > > Hi Mike, > > I had been working on this a couple of months ago. Please refer to > this patch: https://lore.kernel.org/linux-arm-kernel/20260609214205.1260279-1-yang@os.amperecomputing.com/ > > There are three tricky things for ARM64 if I remember correctly (my > memory is a little vague): > 1. ARM64 supports CONT_PTE/CONT_PMD, we do prefer show the counters > for them too. Yeah, makes sense. > 2. Memory hotunplug. The current memory hotunplug code doesn't handle > CONT_PTE/CONT_PMD because it is unnecessary if we don't need to count > the direct mapping entries. I'll take a look at memory hotplug for the next version. > 3. Locking. IIRC, x86 protects the counters update with pgd_lock. > IIUC, ARM64 should need such a lock too. It doesn't after patch 13 in this series :) The counters are atomic, like in s390 today. > Anyway I don't think I'm going to have time to work on this. So please > feel free to take the patch. Thanks! > Thanks, > Yang -- Sincerely yours, Mike.