diff mbox

[RFC,6/9] remove kvm_freed variable

Message ID 20100615135526.C4002017@kernel.beaverton.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Hansen June 15, 2010, 1:55 p.m. UTC
None
diff mbox

Patch

diff -puN arch/x86/kvm/mmu.c~optimize_shrinker-2 arch/x86/kvm/mmu.c
--- linux-2.6.git/arch/x86/kvm/mmu.c~optimize_shrinker-2	2010-06-14 10:24:48.000000000 -0700
+++ linux-2.6.git-dave/arch/x86/kvm/mmu.c	2010-06-14 10:24:48.000000000 -0700
@@ -2951,7 +2951,6 @@  static int shrink_kvm_mmu(struct kvm *kv
 static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask)
 {
 	struct kvm *kvm;
-	struct kvm *kvm_freed = NULL;
 
 	if (nr_to_scan == 0)
 		goto out;
@@ -2959,18 +2958,14 @@  static int mmu_shrink(int nr_to_scan, gf
 	spin_lock(&kvm_lock);
 
 	list_for_each_entry(kvm, &vm_list, vm_list) {
-		if (nr_to_scan <= 0)
-			break;
+		int freed = shrink_kvm_mmu(kvm, nr_to_scan);
+		if (!freed)
+			continue;
 
-		shrink_kvm_mmu(kvm, nr_to_scan);
-		if (!kvm_freed)
-			kvm_freed = kvm;
-		nr_to_scan--;
+		list_move_tail(&kvm->vm_list, &vm_list);
+		break;
 	}
 
-	if (kvm_freed)
-		list_move_tail(&kvm_freed->vm_list, &vm_list);
-
 	spin_unlock(&kvm_lock);
 
 out: