From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [RFC PATCH 3/3] KVM: MMU: Optimize guest page table walk Date: Fri, 29 Apr 2011 22:51:48 +0900 Message-ID: <20110429225148.49e6e700.takuya.yoshikawa@gmail.com> References: <20110419033220.e527bcae.takuya.yoshikawa@gmail.com> <20110419033814.3cc7ab5e.takuya.yoshikawa@gmail.com> <4DAEA123.3020403@redhat.com> <20110429143808.29c51c6a.takuya.yoshikawa@gmail.com> <20110429065956.GA3985@one.firstfloor.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Avi Kivity , mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp To: Andi Kleen Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:47761 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757536Ab1D2Nv4 (ORCPT ); Fri, 29 Apr 2011 09:51:56 -0400 Received: by pzk9 with SMTP id 9so2158895pzk.19 for ; Fri, 29 Apr 2011 06:51:55 -0700 (PDT) In-Reply-To: <20110429065956.GA3985@one.firstfloor.org> Sender: kvm-owner@vger.kernel.org List-ID: Andi Kleen wrote: > > Only I can guess for that reason is the reduction of some function calls > > by inlining some functions. > > Yes once at a time cfu was inline too and just checked for the right > sizes and the used g*u, but it got lost in the "icache over everything else" mania which is unfortunately en vogue for quite some time in kernel land (aka > measuring patches only based on their impact on the .text > size, not the actual performance) > > But you might getter better gains by fixing this general > c*u() regression. > What I mentioned was about not only cfu but 3 functions. Originally, we were doing the following function calls: walk_addr_generic() ---1 kvm_read_guest_page_mmu() ---2 kvm_read_guest_page() ---3 copy_from_user() ---4 And now, with my patch already applied, we are not using generic kvm_read_guest_page_mmu() and some address calculations are done in walk_addr_generic(): walk_addr_generic() ---1' get_user() ---2' The length is passed in from walk_addr_generic(). Do you think the following case would not differ so much from (1' 2') ? walk_addr_generic() ---1'' copy_from_user() ---2'' This can satisfy your "assuming you pass in a constant length" and almost same as get_user() ? Takuya