KVM: Integrate gfn_to_memslot_approx() into search_memslots()
s390 arch has gfn_to_memslot_approx() which is almost identical to search_memslots(), differing only in that in case the gfn falls in a hole one of the memslots bordering the hole is returned. Add this lookup mode as an option to search_memslots() so we don't have two almost identical functions for looking up a memslot by its gfn. Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> [sean: tweaked helper names to keep gfn_to_memslot_approx() in s390] Reviewed-by: Sean Christopherson <seanjc@google.com> Message-Id: <171cd89b52c718dbe180ecd909b4437a64a7e2ec.1638817640.git.maciej.szmigiero@oracle.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
f5756029ee
commit
c928bfc263
@ -2141,7 +2141,7 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn
|
||||
* search_memslots() instead of __gfn_to_memslot() to avoid
|
||||
* thrashing the VM-wide last_used_index in kvm_memslots.
|
||||
*/
|
||||
slot = search_memslots(slots, gfn, &slot_index);
|
||||
slot = search_memslots(slots, gfn, &slot_index, false);
|
||||
if (slot) {
|
||||
vcpu->last_used_slot = slot_index;
|
||||
return slot;
|
||||
|
Reference in New Issue
Block a user