[Devel] [PATCH RH8 4/4] kvm: use kvzalloc for struct kvm allocation

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Wed Jun 16 17:42:35 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 commit 40ee5d7e2a8a8c475eee4406186d4fd6ec66c520)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index fcee0b5..14bdb89 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -914,12 +914,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