Re: [PATCH] KVM: arm64: Reduce the stage-2 page cache on 64 KiB hosts

From: Marc Zyngier

Date: Thu Nov 26 2026 - 10:58:17 EST


On Thu, 26 Nov 2026 14:32:04 +0000,
Usama Arif <usama.arif@xxxxxxxxx> wrote:

[nonsense deleted]

> > Now, to the patch itself: I see no reason to special-case this. If
> > kvm_mmu_cache_min_pages() is an indication of what is needed, then
> > this macro should be driven by it, or the whole allocator take it into
> > account. And then you adjust it by whatever fudge factor seems
> > appropriate.
> >
>
> Completely agree! [1] does that: no page-size special case, and
> a capacity of KVM_PGTABLE_LAST_LEVEL - KVM_PGTABLE_FIRST_LEVEL for every
> page size. It can't track kvm_mmu_cache_min_pages()
> at runtime: the vCPU's cache is shared by the canonical and NV shadow
> MMUs, and its capacity must stay fixed. So it has to cover the largest
> minimum, which stage-2 caps at 3, and 4 is that plus one page of fudge.

Of course it can. That's not exactly rock science to add, rather than
relying on another set of bad heuristics. And this must cover more
than a single mapping per top-up, because that has a ripple effect on
the speed at which we can split large blocks (funnily enough, people
care about that stuff).

M.

--
Without deviation from the norm, progress is not possible.