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) > <[email protected]> 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/[email protected]/ > > 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.
