KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
PATCH 1/1 KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
Generally speaking, any memory allocations that can be associated with a particular VM should be charged to the cgroup of its process. Nonetheless, there are a couple spots in KVM/arm64 that aren't currently accounted:
- the ccsidr array containing the virtualized cache hierarchy
- the cpumask of supported cpus, for use of the vPMU on heterogeneous systems
Go ahead and set __GFP_ACCOUNT for these allocations.
---
Applies to github.com/oupton/linux kvm-arm64/virtual-cache-geometry
arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/sys_regs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/arm.c +1 -1
@@ -146,7 +146,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)if (ret) goto err_unshare_kvm; -if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL )) { +if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL_ACCOUNT )) { ret = -ENOMEM ; goto err_unshare_kvm; }
arch/arm64/kvm/sys_regs.c +1 -1
@@ -160,7 +160,7 @@ static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val)if (val ==get_ccsidr (vcpu, csselr))return 0 ; - ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL ); + ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL_ACCOUNT );if (!ccsidr)return -ENOMEM ;
Signature · 1 line
2.39.1.519.gcb327c4b5f-goog
Quoted 39 lines · Oliver Upton
Generally speaking, any memory allocations that can be associated with a particular VM should be charged to the cgroup of its process. Nonetheless, there are a couple spots in KVM/arm64 that aren't currently accounted:
- the ccsidr array containing the virtualized cache hierarchy
- the cpumask of supported cpus, for use of the vPMU on heterogeneous systems
Go ahead and set
__GFP_ACCOUNTfor these allocations.Signed-off-by Oliver Upton <[email protected]>---
Applies to github.com/oupton/linux kvm-arm64/virtual-cache-geometry
arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/sys_regs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/kvm/arm.c +1
-1@@ -146,7 +146,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)if (ret) goto err_unshare_kvm; -if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL )) { +if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL_ACCOUNT )) { ret = -ENOMEM ; goto err_unshare_kvm; }arch/arm64/kvm/sys_regs.c +0
-0
arch/arm64/kvm/sys_regs.c static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val) · line 166
Quoted 8 lines
arch/arm64/kvm/sys_regs.c +1
-1@@ -160,7 +160,7 @@ static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val)if (val ==get_ccsidr (vcpu, csselr))return 0 ; - ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL ); + ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL_ACCOUNT );if (!ccsidr)return -ENOMEM ;
Quoted 12 lines · Oliver Upton
Generally speaking, any memory allocations that can be associated with a particular VM should be charged to the cgroup of its process. Nonetheless, there are a couple spots in KVM/arm64 that aren't currently accounted:
- the ccsidr array containing the virtualized cache hierarchy
- the cpumask of supported cpus, for use of the vPMU on heterogeneous systems
Go ahead and set
__GFP_ACCOUNTfor these allocations.
Quoted 9 lines
Signed-off-by Oliver Upton <[email protected]>---
Applies to github.com/oupton/linux kvm-arm64/virtual-cache-geometry
arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/sys_regs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 27 lines
arch/arm64/kvm/arm.c +1
-1@@ -146,7 +146,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)if (ret) goto err_unshare_kvm; -if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL )) { +if (!zalloc_cpumask_var (&kvm->arch.supported_cpus,GFP_KERNEL_ACCOUNT )) { ret = -ENOMEM ; goto err_unshare_kvm; }arch/arm64/kvm/sys_regs.c +1
-1@@ -160,7 +160,7 @@ static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val)if (val ==get_ccsidr (vcpu, csselr))return 0 ; - ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL ); + ccsidr =kmalloc_array (CSSELR_MAX ,sizeof (u32),GFP_KERNEL_ACCOUNT );if (!ccsidr)return -ENOMEM ;
Quoted 6 lines · Oliver Upton
Generally speaking, any memory allocations that can be associated with a particular VM should be charged to the cgroup of its process. Nonetheless, there are a couple spots in KVM/arm64 that aren't currently accounted:
Quoted 8 lines
- the ccsidr array containing the virtualized cache hierarchy
- the cpumask of supported cpus, for use of the vPMU on heterogeneous systems
Go ahead and set
__GFP_ACCOUNTfor these allocations.Signed-off-by Oliver Upton <[email protected]>
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Oliver Upton
AppliedQuoted 8 lines · Oliver Upton
Generally speaking, any memory allocations that can be associated with a particular VM should be charged to the cgroup of its process. Nonetheless, there are a couple spots in KVM/arm64 that aren't currently accounted:
- the ccsidr array containing the virtualized cache hierarchy
[...]
Applied to kvmarm/next, thanks!
[1/1] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
https://git.kernel.org/kvmarm/kvmarm/c/5f623a598d12
--
Best,
Oliver