On 9/9/22 12:45, Emanuele Giuseppe Esposito wrote:
/* - * if change is DELETE or MOVE, invalid is in active memslots - * and old in inactive, so replace old with new. + * if change is DELETE or MOVE, invalid is in both active and inactive + * memslot list. This means that we don't need old anymore, and + * we should replace invalid with new. */ - kvm_replace_memslot(kvm, batch->old, batch->new); + if (batch->change == KVM_MR_DELETE || batch->change == KVM_MR_MOVE) + kvm_replace_memslot(kvm, batch->invalid, batch->new); + else + kvm_replace_memslot(kvm, batch->old, batch->new);
This is also kvm_replace_memslot(kvm, batch->invalid ?: batch->old, batch->new); with no need to look at batch->change. Paolo