Skip to contentSkip to conversation

KVM: arm64: nv: Use GFP_KERNEL_ACCOUNT for sysreg_masks allocation

PATCH Applied Oliver Upton 2 participants 3 messages Jun 17, 2024 – Jun 19, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: nv: Use GFP_KERNEL_ACCOUNT for sysreg_masks allocation

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.

---
 arch/arm64/kvm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/nested.c +1 -1
index 6813c7c7f00a..57e3fb3eb334 100644
@@ -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

Signature · 1 line
2.45.2.627.g7a2c4fd464-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Oliver Upton

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.

---
 arch/arm64/kvm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/nested.c +1 -1
index 6813c7c7f00a..57e3fb3eb334 100644
@@ -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;
Quoted 1 line

base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0

Ah, well spotted.

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.