Re: [PATCH 1/2] KVM: x86/mmu: Change KVM mmu shrinker to no-op
From: David Matlack
Date: Wed Sep 25 2024 - 19:54:57 EST
On 2024-09-13 02:43 PM, Vipin Sharma wrote:
> Remove global kvm_total_used_mmu_pages and page zapping flow from MMU
> shrinker. Keep shrinker infrastructure in place to reuse in future
> commits for freeing KVM page caches. Remove zapped_obsolete_pages list
> from struct kvm_arch{} and use local list in kvm_zap_obsolete_pages()
> since MMU shrinker is not using it anymore.
>
> mmu_shrink_scan() is very disruptive to VMs. It picks the first VM in
> the vm_list, zaps the oldest page which is most likely an upper level
> SPTEs and most like to be reused. Prior to TDP MMU, this is even more
> disruptive in nested VMs case, considering L1 SPTEs will be the oldest
> even though most of the entries are for L2 SPTEs.
>
> As discussed in
> https://lore.kernel.org/lkml/Y45dldZnI6OIf+a5@xxxxxxxxxx/ shrinker logic
> has not be very useful in actually keeping VMs performant and reducing
> memory usage.
>
> Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Suggested-by: David Matlack <dmatlack@xxxxxxxxxx>
> Signed-off-by: Vipin Sharma <vipinsh@xxxxxxxxxx>
> ---
Reviewed-by: David Matlack <dmatlack@xxxxxxxxxx>