From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: [PATCH RESEND] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended Date: Fri, 10 Aug 2012 17:16:12 +0900 Message-ID: <20120810171612.f1e48237.yoshikawa.takuya@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, gleb@redhat.com To: avi@redhat.com, mtosatti@redhat.com Return-path: Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]:58893 "EHLO tama50.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757401Ab2HJIQe (ORCPT ); Fri, 10 Aug 2012 04:16:34 -0400 Sender: kvm-owner@vger.kernel.org List-ID: The following commit changed mmu_shrink() so that it would skip VMs whose n_used_mmu_pages was not zero and try to free pages from others: commit 1952639665e92481c34c34c3e2a71bf3e66ba362 KVM: MMU: do not iterate over all VMs in mmu_shrink() This patch fixes the function so that it can free mmu pages as before. Note that "if (!nr_to_scan--)" check is removed since we do not try to free mmu pages from more than one VM. Signed-off-by: Takuya Yoshikawa Cc: Gleb Natapov --- This patch just recovers the original behaviour and is not related to how to improve mmu_shrink() further; so please apply. arch/x86/kvm/mmu.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9651c2c..4aeec72 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4154,11 +4154,8 @@ static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc) * want to shrink a VM that only started to populate its MMU * anyway. */ - if (kvm->arch.n_used_mmu_pages > 0) { - if (!nr_to_scan--) - break; + if (!kvm->arch.n_used_mmu_pages) continue; - } idx = srcu_read_lock(&kvm->srcu); spin_lock(&kvm->mmu_lock); -- 1.7.5.4