]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Use kvzalloc() for kvm struct allocation
authorOliver Upton <oupton@kernel.org>
Wed, 19 Nov 2025 09:38:22 +0000 (01:38 -0800)
committerOliver Upton <oupton@kernel.org>
Wed, 19 Nov 2025 20:20:57 +0000 (12:20 -0800)
Physically-allocated KVM structs aren't necessary when in VHE mode as
there's no need to share with the hyp's address space. Of course, there
can still be a performance benefit from physical allocations.

Use kvzalloc() for opportunistic physical allocations.

Acked-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Link: https://msgid.link/20251119093822.2513142-3-oupton@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/kvm/arm.c

index e791fa52f874b6c61703c40560f6514f34af5316..ecbe2c8dc00c7ea899c5e2ded2f7e658bc7963eb 100644 (file)
@@ -440,7 +440,7 @@ struct kvm *kvm_arch_alloc_vm(void)
        if (!has_vhe())
                return kzalloc(sz, GFP_KERNEL_ACCOUNT);
 
-       return __vmalloc(sz, GFP_KERNEL_ACCOUNT | __GFP_ZERO);
+       return kvzalloc(sz, GFP_KERNEL_ACCOUNT);
 }
 
 int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)