From mboxrd@z Thu Jan 1 00:00:00 1970 From: Izik Eidus Subject: Re: [patch 1/2] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list Date: Tue, 28 Jul 2009 22:05:45 +0300 Message-ID: <4A6F4C09.5050006@redhat.com> References: <20090728182657.694401826@amt.cnet> <20090728182726.079993317@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33057 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbZG1THB (ORCPT ); Tue, 28 Jul 2009 15:07:01 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6SJ72xx006728 for ; Tue, 28 Jul 2009 15:07:02 -0400 In-Reply-To: <20090728182726.079993317@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > From: Izik Eidus > > First check if the list is empty before attempting to look at list > entries. > > Signed-off-by: Izik Eidus > Signed-off-by: Marcelo Tosatti > > Index: kvm/arch/x86/kvm/mmu.c > =================================================================== > --- kvm.orig/arch/x86/kvm/mmu.c > +++ kvm/arch/x86/kvm/mmu.c > @@ -2625,7 +2625,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page > > void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) > { > - while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES) { > + while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES && > + !list_empty(&vcpu->kvm->arch.active_mmu_pages)) { > struct kvm_mmu_page *sp; > > sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev, > > > ack