summaryrefslogtreecommitdiff
path: root/kvm_mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kvm_mmu.c')
-rw-r--r--kvm_mmu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kvm_mmu.c b/kvm_mmu.c
index b809435..6e97936 100644
--- a/kvm_mmu.c
+++ b/kvm_mmu.c
@@ -2939,10 +2939,11 @@ kvm_mmu_calculate_mmu_pages(struct kvm *kvm)
unsigned int nr_pages = 0;
struct kvm_memslots *slots;
+ mutex_enter(&kvm->memslots_lock);
slots = kvm->memslots;
for (i = 0; i < slots->nmemslots; i++)
nr_pages += slots->memslots[i].npages;
-
+ mutex_exit(&kvm->memslots_lock);
nr_mmu_pages = nr_pages * KVM_PERMILLE_MMU_PAGES / 1000;
nr_mmu_pages = MAX(nr_mmu_pages, (unsigned int)KVM_MIN_ALLOC_MMU_PAGES);