Skip to content

Commit

Permalink
KVM: Stop checking rmap to see if slot is being created
Browse files Browse the repository at this point in the history
Instead, check npages consistently.  This helps to make rmap
architecture specific in a later patch.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed Aug 6, 2012
1 parent fe56097 commit aab2eb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -6385,7 +6385,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
*x86 needs to handle !user_alloc case.
*/
if (!user_alloc) {
if (npages && !old.rmap) {
if (npages && !old.npages) {
unsigned long userspace_addr;

userspace_addr = vm_mmap(NULL, 0,
Expand Down Expand Up @@ -6413,7 +6413,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,

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;

ret = vm_munmap(old.userspace_addr,
Expand Down

0 comments on commit aab2eb7

Please sign in to comment.