Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759488AbbEEQIp (ORCPT ); Tue, 5 May 2015 12:08:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46583 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2993294AbbEEPDb convert rfc822-to-8bit (ORCPT ); Tue, 5 May 2015 11:03:31 -0400 From: Bandan Das To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com, guangrong.xiao@linux.intel.com, Yang Zhang , wanpeng.li@linux.intel.com Subject: Re: [PATCH 02/13] KVM: reuse memslot in kvm_write_guest_page References: <1430393772-27208-1-git-send-email-pbonzini@redhat.com> <1430393772-27208-3-git-send-email-pbonzini@redhat.com> Date: Tue, 05 May 2015 11:03:26 -0400 In-Reply-To: <1430393772-27208-3-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Thu, 30 Apr 2015 13:36:01 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1659 Lines: 49 Paolo Bonzini writes: > From: Radim Krčmář > > Saves one O(log N) search. It really doesn't hurt to change this to: "Caching memslot value helps us avoid another O(log N) search later when calling mark_page_dirty_in_slot()." Sorry I am not a fan of commit messages less than 75 characters :) Or you can also call me dumb :) > Signed-off-by: Radim Krčmář > Message-Id: <1428695247-27603-1-git-send-email-rkrcmar@redhat.com> > Signed-off-by: Paolo Bonzini > --- > virt/kvm/kvm_main.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 90977418aeb6..b6d415156283 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1590,15 +1590,17 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data, > int offset, int len) > { > int r; > + struct kvm_memory_slot *memslot; > unsigned long addr; > > - addr = gfn_to_hva(kvm, gfn); > + memslot = gfn_to_memslot(kvm, gfn); > + addr = gfn_to_hva_memslot(memslot, gfn); > if (kvm_is_error_hva(addr)) > return -EFAULT; > r = __copy_to_user((void __user *)addr + offset, data, len); > if (r) > return -EFAULT; > - mark_page_dirty(kvm, gfn); > + mark_page_dirty_in_slot(kvm, memslot, gfn); > return 0; > } > EXPORT_SYMBOL_GPL(kvm_write_guest_page); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/