[Devel] [PATCH RH9 27/30] kvm: use kvzalloc for struct kvm allocation

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Tue Sep 28 21:49:18 MSK 2021


From: Vasiliy Averin <vvs at virtuozzo.com>

struct kvm had increased in RHEL77 and triggeres hugh-order-allocation
warning now.
Let's switch to use kvzalloc to suppress this warning

https://jira.sw.ru/browse/PSBM-97483

Signed-off-by: Vasily Averin <vvs at virtuozzo.com>

(cherry picked from vz7 commit c665b2519fa2 ("kvm: use kvzalloc for struct kvm
allocation"))

Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

(cherry picked from vz8 commit 4f73f93c1db7d082db53f21abda30575a73afa59)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 include/linux/kvm_host.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ae7735b..b910394 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1042,12 +1042,12 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
  */
 static inline struct kvm *kvm_arch_alloc_vm(void)
 {
-	return kzalloc(sizeof(struct kvm), GFP_KERNEL);
+	return kvzalloc(sizeof(struct kvm), GFP_KERNEL);
 }
 
 static inline void kvm_arch_free_vm(struct kvm *kvm)
 {
-	kfree(kvm);
+	kvfree(kvm);
 }
 #endif
 
-- 
1.8.3.1



More information about the Devel mailing list