public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v2] KVM: MMU: optimize pte write path if don't have protected sp
Date: Wed, 11 May 2011 14:28:03 +0300	[thread overview]
Message-ID: <4DCA72C3.6050300@redhat.com> (raw)
In-Reply-To: <4DC9F803.3050602@cn.fujitsu.com>

On 05/11/2011 05:44 AM, Xiao Guangrong wrote:
> Simply return from kvm_mmu_pte_write path if no shadow page is
> write-protected, then we can avoid to walk all shadow pages and hold
> mmu-lock
>
> @@ -1038,8 +1038,10 @@ static void kvm_mmu_free_page(struct kvm *kvm, struct kvm_mmu_page *sp)
>   	hlist_del(&sp->hash_link);
>   	list_del(&sp->link);
>   	free_page((unsigned long)sp->spt);
> -	if (!sp->role.direct)
> +	if (!sp->role.direct) {
>   		free_page((unsigned long)sp->gfns);
> +		atomic_dec(&kvm->arch.indirect_shadow_pages);
> +	}
>   	kmem_cache_free(mmu_page_header_cache, sp);
>   	kvm_mod_used_mmu_pages(kvm, -1);
>   }
> @@ -1536,6 +1538,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
>   			kvm_sync_pages(vcpu, gfn);
>
>   		account_shadowed(vcpu->kvm, gfn);
> +		atomic_inc(&vcpu->kvm->arch.indirect_shadow_pages);
>   	}

Better in account_shadowed()/unaccount_shadowed(), no?


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-05-11 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  2:44 [PATCH v2] KVM: MMU: optimize pte write path if don't have protected sp Xiao Guangrong
2011-05-11 11:28 ` Avi Kivity [this message]
2011-05-11 12:01   ` Xiao Guangrong

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=4DCA72C3.6050300@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /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