mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 19:30:52 +07:00
kvm: update_memslots: drop not needed check for the same number of pages
if number of pages haven't changed sorting algorithm will do nothing, so there is no need to do extra check to avoid entering sorting logic. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
45c3094a64
commit
5a38b6e6b4
@ -679,21 +679,19 @@ static void update_memslots(struct kvm_memslots *slots,
|
||||
struct kvm_memory_slot *mslots = slots->memslots;
|
||||
|
||||
WARN_ON(mslots[i].id != id);
|
||||
if (new->npages != mslots[i].npages) {
|
||||
if (new->npages < mslots[i].npages) {
|
||||
while (i < KVM_MEM_SLOTS_NUM - 1 &&
|
||||
new->npages < mslots[i + 1].npages) {
|
||||
mslots[i] = mslots[i + 1];
|
||||
slots->id_to_index[mslots[i].id] = i;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
while (i > 0 &&
|
||||
new->npages > mslots[i - 1].npages) {
|
||||
mslots[i] = mslots[i - 1];
|
||||
slots->id_to_index[mslots[i].id] = i;
|
||||
i--;
|
||||
}
|
||||
if (new->npages < mslots[i].npages) {
|
||||
while (i < KVM_MEM_SLOTS_NUM - 1 &&
|
||||
new->npages < mslots[i + 1].npages) {
|
||||
mslots[i] = mslots[i + 1];
|
||||
slots->id_to_index[mslots[i].id] = i;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
while (i > 0 &&
|
||||
new->npages > mslots[i - 1].npages) {
|
||||
mslots[i] = mslots[i - 1];
|
||||
slots->id_to_index[mslots[i].id] = i;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user