From: Marcelo Tosatti <mtosatti@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, kvm@vger.kernel.org, gleb@redhat.com
Subject: Re: [PATCH RESEND] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended
Date: Mon, 13 Aug 2012 19:15:23 -0300 [thread overview]
Message-ID: <20120813221523.GA21083@amt.cnet> (raw)
In-Reply-To: <20120810171612.f1e48237.yoshikawa.takuya@oss.ntt.co.jp>
On Fri, Aug 10, 2012 at 05:16:12PM +0900, Takuya Yoshikawa wrote:
> 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 <yoshikawa.takuya@oss.ntt.co.jp>
> Cc: Gleb Natapov <gleb@redhat.com>
> ---
> This patch just recovers the original behaviour and is not related
> to how to improve mmu_shrink() further; so please apply.
Before 1952639665e92481c34 the code was maxed at nr_to_scan loops. So
removing if (!nr_to_scan--) patch does change behaviour.
Am i missing something here?
> 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
next prev parent reply other threads:[~2012-08-13 22:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-10 8:16 [PATCH RESEND] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended Takuya Yoshikawa
2012-08-13 22:15 ` Marcelo Tosatti [this message]
2012-08-14 0:06 ` Takuya Yoshikawa
2012-08-14 15:17 ` Marcelo Tosatti
2012-08-15 2:11 ` Takuya Yoshikawa
2012-08-15 18:22 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120813221523.GA21083@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).