diff mbox series

KVM: use vfree for memory allocated by vcalloc/__vcalloc

Message ID 20240131012357.53563-1-lirongqing@baidu.com (mailing list archive)
State New, archived
Headers show
Series KVM: use vfree for memory allocated by vcalloc/__vcalloc | expand

Commit Message

Li RongQing Jan. 31, 2024, 1:23 a.m. UTC
commit 37b2a6510a48("KVM: use __vcalloc for very large allocations")
replaced kvzalloc/kvcalloc with vcalloc, but not replace kvfree with
vfree

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/kvm/mmu/page_track.c | 2 +-
 arch/x86/kvm/x86.c            | 6 +++---
 virt/kvm/kvm_main.c           | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Li RongQing March 15, 2024, 11:55 a.m. UTC | #1
> -----Original Message-----
> From: Li,Rongqing <lirongqing@baidu.com>
> Sent: Wednesday, January 31, 2024 9:24 AM
> To: kvm@vger.kernel.org
> Cc: Li,Rongqing <lirongqing@baidu.com>
> Subject: [PATCH] KVM: use vfree for memory allocated by vcalloc/__vcalloc
> 
> commit 37b2a6510a48("KVM: use __vcalloc for very large allocations")
> replaced kvzalloc/kvcalloc with vcalloc, but not replace kvfree with vfree
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>


Ping

Thanks

-Li
Sean Christopherson April 10, 2024, 12:19 a.m. UTC | #2
On Wed, 31 Jan 2024 09:23:57 +0800, Li RongQing wrote:
> commit 37b2a6510a48("KVM: use __vcalloc for very large allocations")
> replaced kvzalloc/kvcalloc with vcalloc, but not replace kvfree with
> vfree
> 
> 

Applied to kvm-x86 misc, thanks!

[1/1] KVM: use vfree for memory allocated by vcalloc/__vcalloc
      https://github.com/kvm-x86/linux/commit/a952d608f0be

--
https://github.com/kvm-x86/linux/tree/next
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c
index c87da11..6faed29 100644
--- a/arch/x86/kvm/mmu/page_track.c
+++ b/arch/x86/kvm/mmu/page_track.c
@@ -28,7 +28,7 @@  bool kvm_page_track_write_tracking_enabled(struct kvm *kvm)
 
 void kvm_page_track_free_memslot(struct kvm_memory_slot *slot)
 {
-	kvfree(slot->arch.gfn_write_track);
+	vfree(slot->arch.gfn_write_track);
 	slot->arch.gfn_write_track = NULL;
 }
 
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 363b1c080..a1f9fe6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -12711,7 +12711,7 @@  static void memslot_rmap_free(struct kvm_memory_slot *slot)
 	int i;
 
 	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
-		kvfree(slot->arch.rmap[i]);
+		vfree(slot->arch.rmap[i]);
 		slot->arch.rmap[i] = NULL;
 	}
 }
@@ -12723,7 +12723,7 @@  void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot)
 	memslot_rmap_free(slot);
 
 	for (i = 1; i < KVM_NR_PAGE_SIZES; ++i) {
-		kvfree(slot->arch.lpage_info[i - 1]);
+		vfree(slot->arch.lpage_info[i - 1]);
 		slot->arch.lpage_info[i - 1] = NULL;
 	}
 
@@ -12815,7 +12815,7 @@  static int kvm_alloc_memslot_metadata(struct kvm *kvm,
 	memslot_rmap_free(slot);
 
 	for (i = 1; i < KVM_NR_PAGE_SIZES; ++i) {
-		kvfree(slot->arch.lpage_info[i - 1]);
+		vfree(slot->arch.lpage_info[i - 1]);
 		slot->arch.lpage_info[i - 1] = NULL;
 	}
 	return -ENOMEM;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 10bfc88..4f98557 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1018,7 +1018,7 @@  static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
 	if (!memslot->dirty_bitmap)
 		return;
 
-	kvfree(memslot->dirty_bitmap);
+	vfree(memslot->dirty_bitmap);
 	memslot->dirty_bitmap = NULL;
 }