On Fri, Nov 1, 2024 at 1:14 PM Vipin Sharma <vipinsh@xxxxxxxxxx> wrote: > > Remove KVM MMU shrinker and all its related code. Remove global > kvm_total_used_mmu_pages and page zapping flow from MMU shrinker. > 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. > > Current flow of KVM MMU shrinker 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 [1] shrinker logic has not be very useful in actually > keeping VMs performant and reducing memory usage. > > There was an alternative suggested [2] to repurpose shrinker for > shrinking vCPU caches. But considering that in all of the KVM MMU > shrinker history it hasn't been used/needed/complained, and there has > not been any conversation regarding KVM using lots of page tables, it > might be better to just not have shrinker. If the need arise [2] can be > revisited. > > [1] https://lore.kernel.org/lkml/Y45dldZnI6OIf+a5@xxxxxxxxxx/ > [2] https://lore.kernel.org/kvm/20241004195540.210396-3-vipinsh@xxxxxxxxxx/ > > Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx> > Suggested-by: David Matlack <dmatlack@xxxxxxxxxx> > Reviewed-by: David Matlack <dmatlack@xxxxxxxxxx> FYI, I carried forward David's Reviewed-by from the previous versions. Extra change from the previous version is removing registration of KVM MMU shrinker in kvm_mmu_vendor_module_init() and mmu_shrinker object along with its callback functions.