Commit 548ef284 authored by Thomas Huth's avatar Thomas Huth Committed by Marcelo Tosatti

KVM: Get rid of kvm_kvfree()

kvm_kvfree() provides exactly the same functionality as the
new common kvfree() function - so let's simply replace the
kvm function with the common function.
Signed-off-by: default avatarThomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 0fa97788
...@@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free, ...@@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) { if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) {
kvm_kvfree(free->arch.rmap[i]); kvfree(free->arch.rmap[i]);
free->arch.rmap[i] = NULL; free->arch.rmap[i] = NULL;
} }
if (i == 0) if (i == 0)
...@@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free, ...@@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
if (!dont || free->arch.lpage_info[i - 1] != if (!dont || free->arch.lpage_info[i - 1] !=
dont->arch.lpage_info[i - 1]) { dont->arch.lpage_info[i - 1]) {
kvm_kvfree(free->arch.lpage_info[i - 1]); kvfree(free->arch.lpage_info[i - 1]);
free->arch.lpage_info[i - 1] = NULL; free->arch.lpage_info[i - 1] = NULL;
} }
} }
...@@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, ...@@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
out_free: out_free:
for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
kvm_kvfree(slot->arch.rmap[i]); kvfree(slot->arch.rmap[i]);
slot->arch.rmap[i] = NULL; slot->arch.rmap[i] = NULL;
if (i == 0) if (i == 0)
continue; continue;
kvm_kvfree(slot->arch.lpage_info[i - 1]); kvfree(slot->arch.lpage_info[i - 1]);
slot->arch.lpage_info[i - 1] = NULL; slot->arch.lpage_info[i - 1] = NULL;
} }
return -ENOMEM; return -ENOMEM;
......
...@@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); ...@@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
void *kvm_kvzalloc(unsigned long size); void *kvm_kvzalloc(unsigned long size);
void kvm_kvfree(const void *addr);
#ifndef __KVM_HAVE_ARCH_VM_ALLOC #ifndef __KVM_HAVE_ARCH_VM_ALLOC
static inline struct kvm *kvm_arch_alloc_vm(void) static inline struct kvm *kvm_arch_alloc_vm(void)
......
...@@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size) ...@@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size)
return kzalloc(size, GFP_KERNEL); return kzalloc(size, GFP_KERNEL);
} }
void kvm_kvfree(const void *addr)
{
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot) static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
{ {
if (!memslot->dirty_bitmap) if (!memslot->dirty_bitmap)
return; return;
kvm_kvfree(memslot->dirty_bitmap); kvfree(memslot->dirty_bitmap);
memslot->dirty_bitmap = NULL; memslot->dirty_bitmap = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment