Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm64: Use kvzalloc() for kvm struct allocation

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>

+1 -1
+1 -1
arch/arm64/kvm/arm.c
··· 440 440 if (!has_vhe()) 441 441 return kzalloc(sz, GFP_KERNEL_ACCOUNT); 442 442 443 - return __vmalloc(sz, GFP_KERNEL_ACCOUNT | __GFP_ZERO); 443 + return kvzalloc(sz, GFP_KERNEL_ACCOUNT); 444 444 } 445 445 446 446 int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)