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=1796196409; b=j6dU2rWReq+7ElVCWGc/KYT34nlesCBwEuubrMw1f7iV/DruEz4YFLw9Jt8pV3c9MA7n LpoPN/86mPM3KULfo02v64hHdYiyXtVvZJfO4iVwgM4q0gRFGl/rnfJR17pyzuotNDuU5 L7YD3XLvNkEu2ClCeX7+ssTWT3FsTE87/k0gh9XorUWwtgBwQSByB+l00zmGdtlIsC53i eEU5MxU5REXEMm06k2x93C/EIKk25XhMoDXsRftWrmJMo96nnuw5x2CKCb2UhQOw4PdRW 0wNkdJKfO4KJB+vHNyjOPZFl6N5NJQhx3sO0dBhvfTM29HtI+uv75548h+jdiPTgLmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796196409; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=giQ2/CIzZrWkAXSnq7RtoKJUh24ugGTMdfD/pmXnEBQ=; b=zhSdSY1je8Sy0GPY2Gm3jjMTfSIhXgxls1EU3y5vKQ5sjOXn3BWCEO5jXm4LM5YPScRn lcQ3eiCBuqRjIGWeIXA1lUXbV8ZsGOq4+G7XuIpOI8syHC6Zdw6HbEoBEYBeWBLKLnNLP 21HGozqRtK7AOGALUsK4B8Gwv0FvvD+ZsfDbwt2bOsPQOk8Qh0NWDqTge6gTjsBwx3fqP gOleAXAS7VGbhPtBtX4UuQ84I/yz4aLIUdRgBBuMFuxcyL194wcy8eoYzm8jNyYT4unip ukB2BvMP1D1EKIMHWZbdY0MnFfgeEDAFJxiiby8nKsob+qkCQiimzaeXTvO+R/gfldg== 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="OcwOiD/u"; 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 A36C2606A322; Wed, 2 Dec 2026 07:26:49 +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=OcwOiD/u 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-Mailing-List: linux-arch@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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.