From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC] KVM MMU: improve large munmap efficiency Date: Sun, 29 Jan 2012 15:25:59 +0200 Message-ID: <4F2548E7.9070807@redhat.com> References: <4F2526FE.8040603@redhat.com> <20120129222250.c69609adad5dd196cda91575@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Eric Northup , KVM To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56621 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021Ab2A2N0F (ORCPT ); Sun, 29 Jan 2012 08:26:05 -0500 In-Reply-To: <20120129222250.c69609adad5dd196cda91575@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/29/2012 03:22 PM, Takuya Yoshikawa wrote: > On Sun, 29 Jan 2012 13:01:18 +0200 > Avi Kivity wrote: > > > > Tested by attaching a debugger to a running qemu w/kvm and running > > > "call munmap(0, 1UL << 46)". > > > > > > > How about computing the intersection of (start, end) with the hva ranges > > in kvm->memslots? > > > > If there is no intersection, you exit immediately. > > I think introducing kvm_handle_hva_range() is the right thing if we really > care about unmapping large area at once. > > Current iteration: > for each page > for each slot > for each level > > My suggestion: > for each slot > for each level > for each page > > This way compiler can optimize the task to be a simple iteration over the > rmap array. Yes. This automatically includes the intersection calculation, since you have to do it for the 'for each page in slot' loop. -- error compiling committee.c: too many arguments to function