public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()
Date: Tue, 17 Mar 2015 09:58:21 +0100	[thread overview]
Message-ID: <5507ECAD.1030908@redhat.com> (raw)
In-Reply-To: <20150317161958.991bd7dc36c714f6498821db@lab.ntt.co.jp>



On 17/03/2015 08:19, Takuya Yoshikawa wrote:
> When all bits in mask are not set,
> kvm_arch_mmu_enable_log_dirty_pt_masked() has nothing to do.  But since
> it needs to be called from the generic code, it cannot be inlined, and
> a few function calls, two when PML is enabled, are wasted.
> 
> Since it is common to see many pages remain clean, e.g. framebuffers can
> stay calm for a long time, it is worth eliminating this overhead.
> 
> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
> ---
>  virt/kvm/kvm_main.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a109370..420d8cf 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1061,9 +1061,11 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
>  		mask = xchg(&dirty_bitmap[i], 0);
>  		dirty_bitmap_buffer[i] = mask;
>  
> -		offset = i * BITS_PER_LONG;
> -		kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset,
> -								mask);
> +		if (mask) {
> +			offset = i * BITS_PER_LONG;
> +			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> +								offset, mask);
> +		}
>  	}
>  
>  	spin_unlock(&kvm->mmu_lock);
> 

Good catch!

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

  reply	other threads:[~2015-03-17  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  7:19 [PATCH] KVM: Eliminate extra function calls in kvm_get_dirty_log_protect() Takuya Yoshikawa
2015-03-17  8:58 ` Paolo Bonzini [this message]
2015-03-19  1:23   ` 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=5507ECAD.1030908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yoshikawa_takuya_b1@lab.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