aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1fd8e3b58cc0..ff7cf632175b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1987,6 +1987,8 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask)
1987 list_for_each_entry(kvm, &vm_list, vm_list) { 1987 list_for_each_entry(kvm, &vm_list, vm_list) {
1988 int npages; 1988 int npages;
1989 1989
1990 if (!down_read_trylock(&kvm->slots_lock))
1991 continue;
1990 spin_lock(&kvm->mmu_lock); 1992 spin_lock(&kvm->mmu_lock);
1991 npages = kvm->arch.n_alloc_mmu_pages - 1993 npages = kvm->arch.n_alloc_mmu_pages -
1992 kvm->arch.n_free_mmu_pages; 1994 kvm->arch.n_free_mmu_pages;
@@ -1999,6 +2001,7 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask)
1999 nr_to_scan--; 2001 nr_to_scan--;
2000 2002
2001 spin_unlock(&kvm->mmu_lock); 2003 spin_unlock(&kvm->mmu_lock);
2004 up_read(&kvm->slots_lock);
2002 } 2005 }
2003 if (kvm_freed) 2006 if (kvm_freed)
2004 list_move_tail(&kvm_freed->vm_list, &vm_list); 2007 list_move_tail(&kvm_freed->vm_list, &vm_list);