diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/x86.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 785ae0c300f7..b9c2b8e6c70c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6105,7 +6105,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
6105 | int user_alloc) | 6105 | int user_alloc) |
6106 | { | 6106 | { |
6107 | 6107 | ||
6108 | int npages = mem->memory_size >> PAGE_SHIFT; | 6108 | int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; |
6109 | 6109 | ||
6110 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { | 6110 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { |
6111 | int ret; | 6111 | int ret; |
@@ -6120,12 +6120,12 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
6120 | "failed to munmap memory\n"); | 6120 | "failed to munmap memory\n"); |
6121 | } | 6121 | } |
6122 | 6122 | ||
6123 | if (!kvm->arch.n_requested_mmu_pages) | ||
6124 | nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm); | ||
6125 | |||
6123 | spin_lock(&kvm->mmu_lock); | 6126 | spin_lock(&kvm->mmu_lock); |
6124 | if (!kvm->arch.n_requested_mmu_pages) { | 6127 | if (nr_mmu_pages) |
6125 | unsigned int nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm); | ||
6126 | kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); | 6128 | kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); |
6127 | } | ||
6128 | |||
6129 | kvm_mmu_slot_remove_write_access(kvm, mem->slot); | 6129 | kvm_mmu_slot_remove_write_access(kvm, mem->slot); |
6130 | spin_unlock(&kvm->mmu_lock); | 6130 | spin_unlock(&kvm->mmu_lock); |
6131 | } | 6131 | } |