* [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
@ 2023-02-06 23:52 Oliver Upton
2023-02-07 0:18 ` Akihiko Odaki
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Oliver Upton @ 2023-02-06 23:52 UTC (permalink / raw)
To: Marc Zyngier
Cc: James Morse, Suzuki K Poulose, kvmarm, Akihiko Odaki, Zenghui Yu,
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_ACCOUNT for these allocations.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
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(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 9c5573bc4614..3619f1e472f5 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -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;
}
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 6a742af8010f..5dc13d02721e 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -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;
--
2.39.1.519.gcb327c4b5f-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
2023-02-06 23:52 [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT Oliver Upton
@ 2023-02-07 0:18 ` Akihiko Odaki
2023-02-07 5:02 ` Gavin Shan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Akihiko Odaki @ 2023-02-07 0:18 UTC (permalink / raw)
To: Oliver Upton, Marc Zyngier
Cc: James Morse, Suzuki K Poulose, kvmarm, Zenghui Yu
On 2023/02/07 8:52, Oliver Upton wrote:
> 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.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>
> 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(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 9c5573bc4614..3619f1e472f5 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -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;
> }
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 6a742af8010f..5dc13d02721e 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -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;
>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
2023-02-06 23:52 [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT Oliver Upton
2023-02-07 0:18 ` Akihiko Odaki
@ 2023-02-07 5:02 ` Gavin Shan
2023-02-07 9:31 ` Marc Zyngier
2023-02-08 17:30 ` Oliver Upton
3 siblings, 0 replies; 5+ messages in thread
From: Gavin Shan @ 2023-02-07 5:02 UTC (permalink / raw)
To: Oliver Upton, Marc Zyngier
Cc: James Morse, Suzuki K Poulose, kvmarm, Akihiko Odaki, Zenghui Yu
On 2/7/23 10:52 AM, Oliver Upton wrote:
> 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.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>
> 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(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 9c5573bc4614..3619f1e472f5 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -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;
> }
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 6a742af8010f..5dc13d02721e 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -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;
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
2023-02-06 23:52 [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT Oliver Upton
2023-02-07 0:18 ` Akihiko Odaki
2023-02-07 5:02 ` Gavin Shan
@ 2023-02-07 9:31 ` Marc Zyngier
2023-02-08 17:30 ` Oliver Upton
3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2023-02-07 9:31 UTC (permalink / raw)
To: Oliver Upton
Cc: James Morse, Suzuki K Poulose, kvmarm, Akihiko Odaki, Zenghui Yu
On Mon, 06 Feb 2023 23:52:29 +0000,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> 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.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT
2023-02-06 23:52 [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT Oliver Upton
` (2 preceding siblings ...)
2023-02-07 9:31 ` Marc Zyngier
@ 2023-02-08 17:30 ` Oliver Upton
3 siblings, 0 replies; 5+ messages in thread
From: Oliver Upton @ 2023-02-08 17:30 UTC (permalink / raw)
To: Oliver Upton, Marc Zyngier
Cc: Akihiko Odaki, Suzuki K Poulose, kvmarm, James Morse, Zenghui Yu
On Mon, 6 Feb 2023 23:52:29 +0000, Oliver Upton wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-08 17:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 23:52 [PATCH] KVM: arm64: Mark some VM-scoped allocations as __GFP_ACCOUNT Oliver Upton
2023-02-07 0:18 ` Akihiko Odaki
2023-02-07 5:02 ` Gavin Shan
2023-02-07 9:31 ` Marc Zyngier
2023-02-08 17:30 ` Oliver Upton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.