diff mbox series

KVM: arm64: nv: Use GFP_KERNEL_ACCOUNT for sysreg_masks allocation

Message ID 20240617181018.2054332-1-oliver.upton@linux.dev (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: nv: Use GFP_KERNEL_ACCOUNT for sysreg_masks allocation | expand

Commit Message

Oliver Upton June 17, 2024, 6:10 p.m. UTC
Of course, userspace is in the driver's seat for struct kvm and
associated allocations. Make sure the sysreg_masks allocation
participates in kmem accounting.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 arch/arm64/kvm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0

Comments

Marc Zyngier June 17, 2024, 6:17 p.m. UTC | #1
On Mon, 17 Jun 2024 19:10:18 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
> 
> Of course, userspace is in the driver's seat for struct kvm and
> associated allocations. Make sure the sysreg_masks allocation
> participates in kmem accounting.
> 
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>  arch/arm64/kvm/nested.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
> index 6813c7c7f00a..57e3fb3eb334 100644
> --- a/arch/arm64/kvm/nested.c
> +++ b/arch/arm64/kvm/nested.c
> @@ -196,7 +196,7 @@ int kvm_init_nv_sysregs(struct kvm *kvm)
>  		goto out;
>  
>  	kvm->arch.sysreg_masks = kzalloc(sizeof(*(kvm->arch.sysreg_masks)),
> -					 GFP_KERNEL);
> +					 GFP_KERNEL_ACCOUNT);
>  	if (!kvm->arch.sysreg_masks) {
>  		ret = -ENOMEM;
>  		goto out;
> 
> base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0

Ah, well spotted.

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.
Oliver Upton June 19, 2024, 8:44 a.m. UTC | #2
On Mon, 17 Jun 2024 18:10:18 +0000, Oliver Upton wrote:
> Of course, userspace is in the driver's seat for struct kvm and
> associated allocations. Make sure the sysreg_masks allocation
> participates in kmem accounting.
> 
> 

Applied to kvmarm/next, thanks!

[1/1] KVM: arm64: nv: Use GFP_KERNEL_ACCOUNT for sysreg_masks allocation
      https://git.kernel.org/kvmarm/kvmarm/c/3dc14eefa504

--
Best,
Oliver
diff mbox series

Patch

diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index 6813c7c7f00a..57e3fb3eb334 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -196,7 +196,7 @@  int kvm_init_nv_sysregs(struct kvm *kvm)
 		goto out;
 
 	kvm->arch.sysreg_masks = kzalloc(sizeof(*(kvm->arch.sysreg_masks)),
-					 GFP_KERNEL);
+					 GFP_KERNEL_ACCOUNT);
 	if (!kvm->arch.sysreg_masks) {
 		ret = -ENOMEM;
 		goto out;