From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [RFC PATCH 3/3] KVM: MMU: Optimize guest page table walk Date: Mon, 18 Apr 2011 20:52:03 +0200 Message-ID: <20110418185203.GC8155@8bytes.org> References: <20110419033220.e527bcae.takuya.yoshikawa@gmail.com> <20110419033814.3cc7ab5e.takuya.yoshikawa@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp To: Takuya Yoshikawa Return-path: Received: from 8bytes.org ([88.198.83.132]:47384 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756380Ab1DRSwE (ORCPT ); Mon, 18 Apr 2011 14:52:04 -0400 Content-Disposition: inline In-Reply-To: <20110419033814.3cc7ab5e.takuya.yoshikawa@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Apr 19, 2011 at 03:38:14AM +0900, Takuya Yoshikawa wrote: > From: Takuya Yoshikawa > > We optimize multi level guest page table walk as follows: > > 1. We cache the memslot which, probably, includes the next guest page > tables to avoid searching for it many times. > 2. We use get_user() instead of copy_from_user(). > > Note that this is kind of a restricted way of Xiao's more generic > work: "KVM: optimize memslots searching and cache GPN to GFN." > > With this patch applied, paging64_walk_addr_generic() has improved > as the following tracing results show. > > Before: > 3.169 us | paging64_walk_addr_generic(); > 1.880 us | paging64_walk_addr_generic(); > 1.243 us | paging64_walk_addr_generic(); > 1.517 us | paging64_walk_addr_generic(); > 3.009 us | paging64_walk_addr_generic(); > 1.814 us | paging64_walk_addr_generic(); > 1.340 us | paging64_walk_addr_generic(); > 1.659 us | paging64_walk_addr_generic(); > 1.748 us | paging64_walk_addr_generic(); > 1.488 us | paging64_walk_addr_generic(); > > After: > 1.714 us | paging64_walk_addr_generic(); > 0.806 us | paging64_walk_addr_generic(); > 0.664 us | paging64_walk_addr_generic(); > 0.619 us | paging64_walk_addr_generic(); > 0.645 us | paging64_walk_addr_generic(); > 0.605 us | paging64_walk_addr_generic(); > 1.388 us | paging64_walk_addr_generic(); > 0.753 us | paging64_walk_addr_generic(); > 0.594 us | paging64_walk_addr_generic(); > 0.833 us | paging64_walk_addr_generic(); Nice optimization! What scenarios have you used to test it? Joerg