mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
KVM: Simplify kvm_free_memslot() and all its descendents
Now that all callers of kvm_free_memslot() pass NULL for @dont, remove the param from the top-level routine and all arch's implementations. No functional change intended. Tested-by: Christoffer Dall <christoffer.dall@arm.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
5c0b4f3d5c
commit
e96c81ee89
@@ -2349,8 +2349,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
|
||||
struct kvm_memory_slot *dont)
|
||||
void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -580,18 +580,14 @@ static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
|
||||
memslot->dirty_bitmap = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free any memory in @free but not in @dont.
|
||||
*/
|
||||
static void kvm_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
|
||||
struct kvm_memory_slot *dont)
|
||||
static void kvm_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot)
|
||||
{
|
||||
if (!dont || free->dirty_bitmap != dont->dirty_bitmap)
|
||||
kvm_destroy_dirty_bitmap(free);
|
||||
kvm_destroy_dirty_bitmap(slot);
|
||||
|
||||
kvm_arch_free_memslot(kvm, free, dont);
|
||||
kvm_arch_free_memslot(kvm, slot);
|
||||
|
||||
free->npages = 0;
|
||||
slot->flags = 0;
|
||||
slot->npages = 0;
|
||||
}
|
||||
|
||||
static void kvm_free_memslots(struct kvm *kvm, struct kvm_memslots *slots)
|
||||
@@ -602,7 +598,7 @@ static void kvm_free_memslots(struct kvm *kvm, struct kvm_memslots *slots)
|
||||
return;
|
||||
|
||||
kvm_for_each_memslot(memslot, slots)
|
||||
kvm_free_memslot(kvm, memslot, NULL);
|
||||
kvm_free_memslot(kvm, memslot);
|
||||
|
||||
kvfree(slots);
|
||||
}
|
||||
@@ -1060,7 +1056,7 @@ static int kvm_delete_memslot(struct kvm *kvm,
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
kvm_free_memslot(kvm, old, NULL);
|
||||
kvm_free_memslot(kvm, old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user