Commit aab2eb7a authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Avi Kivity

KVM: Stop checking rmap to see if slot is being created

Instead, check npages consistently.  This helps to make rmap
architecture specific in a later patch.
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent fe56097b
...@@ -6385,7 +6385,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, ...@@ -6385,7 +6385,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
*x86 needs to handle !user_alloc case. *x86 needs to handle !user_alloc case.
*/ */
if (!user_alloc) { if (!user_alloc) {
if (npages && !old.rmap) { if (npages && !old.npages) {
unsigned long userspace_addr; unsigned long userspace_addr;
userspace_addr = vm_mmap(NULL, 0, userspace_addr = vm_mmap(NULL, 0,
...@@ -6413,7 +6413,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, ...@@ -6413,7 +6413,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT;
if (!user_alloc && !old.user_alloc && old.rmap && !npages) { if (!user_alloc && !old.user_alloc && old.npages && !npages) {
int ret; int ret;
ret = vm_munmap(old.userspace_addr, ret = vm_munmap(old.userspace_addr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment