Skip to contentSkip to conversation

KVM: Use kmalloc() instead of vmalloc() for KVM_[GS]ET_MSR

PATCH New Avi Kivity 1 participant 1 message Jul 23, 2010

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: Use kmalloc() instead of vmalloc() for KVM_[GS]ET_MSR

We don't need more than a page, and vmalloc() is slower (much slower recently due to a regression).

---
 arch/x86/kvm/x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +2 -2
index 84bfb51..76fbc32 100644
@@ -1626,7 +1626,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
 
 	r = -ENOMEM;
 	size = sizeof(struct kvm_msr_entry) * msrs.nmsrs;
-	entries = vmalloc(size);
+	entries = kmalloc(size, GFP_KERNEL);
 	if (!entries)
 		goto out;
 
@@ -1645,7 +1645,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
 	r = n;
 
 out_free:
-	vfree(entries);
+	kfree(entries);
 out:
 	return r;
 }
Signature · 1 line
1.7.1