]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Batch zap MMU pages when shrinking the slab
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 23 Jun 2020 19:35:41 +0000 (12:35 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 20:21:52 +0000 (16:21 -0400)
commitd5c4b916f22f8988f4cb30ff7cfc68f54fc620c3
treeb8fd7433ded8cc13461c109c5cdddbea74bde168
parentae8ad6080798551f80bdcbad20412b8c444e88cb
KVM: x86/mmu: Batch zap MMU pages when shrinking the slab

Use the recently introduced kvm_mmu_zap_oldest_mmu_pages() to batch zap
MMU pages when shrinking a slab.  This fixes a long standing issue where
KVM's shrinker implementation is completely ineffective due to zapping
only a single page.  E.g. without batch zapping, forcing a scan via
drop_caches basically has no impact on a VM with ~2k shadow pages.  With
batch zapping, the number of shadow pages can be reduced to a few
hundred pages in one or two runs of drop_caches.

Note, if the default batch size (currently 128) is problematic, e.g.
zapping 128 pages holds mmu_lock for too long, KVM can bound the batch
size by setting @batch in mmu_shrinker.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200623193542.7554-4-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c