提交 0a706bee 编写于 作者: T Takuya Yoshikawa 提交者: Gleb Natapov

KVM: set_memory_region: Don't check for overlaps unless we create or move a slot

Don't need the check for deleting an existing slot or just modifiying
the flags.
Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: NTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: NGleb Natapov <gleb@redhat.com>
上级 0ea75e1d
......@@ -782,6 +782,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
if (!npages && !old.npages)
goto out;
if ((npages && !old.npages) || (base_gfn != old.base_gfn)) {
/* Check for overlaps */
r = -EEXIST;
kvm_for_each_memslot(slot, kvm->memslots) {
......@@ -791,6 +792,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
(base_gfn >= slot->base_gfn + slot->npages)))
goto out;
}
}
/* Free page dirty bitmap if unneeded */
if (!(new.flags & KVM_MEM_LOG_DIRTY_PAGES))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册