]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: leverage change to adjust slots->used_slots in update_memslots()
authorWei Yang <richard.weiyang@gmail.com>
Wed, 22 Aug 2018 13:57:11 +0000 (21:57 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Oct 2018 22:29:48 +0000 (00:29 +0200)
commitff51e302b4a0a1b4615a2b6c5703988055c9fcbb
tree222a3c04a58bfdfbbd58d72bdc9da3f665b92998
parentf2a57ad1996698805ecb73f0edc8ba66d00d650c
KVM: leverage change to adjust slots->used_slots in update_memslots()

update_memslots() is only called by __kvm_set_memory_region(), in which
"change" is calculated and indicates how to adjust slots->used_slots

  * increase by one if it is KVM_MR_CREATE
  * decrease by one if it is KVM_MR_DELETE
  * not change for others

This patch adjusts slots->used_slots in update_memslots() based on "change"
value instead of re-calculate those states again.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c