[patch 1/2] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list

2009-07-28 Thread Marcelo Tosatti
From: Izik Eidus iei...@redhat.com

First check if the list is empty before attempting to look at list
entries.

Signed-off-by: Izik Eidus iei...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

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,


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 1/2] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list

2009-07-28 Thread Izik Eidus

Marcelo Tosatti wrote:

From: Izik Eidus iei...@redhat.com

First check if the list is empty before attempting to look at list
entries.

Signed-off-by: Izik Eidus iei...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

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
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html