From: Marc Zyngier <maz@kernel.org>
To: Li RongQing <lirongqing@baidu.com>
Cc: oliver.upton@linux.dev, james.morse@arm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
catalin.marinas@arm.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev
Subject: Re: [PATCH] KVM: arm64: Consider NUMA affinity when allocating per-CPU stack_page
Date: Mon, 15 Apr 2024 08:36:14 +0100 [thread overview]
Message-ID: <86bk6brsb5.wl-maz@kernel.org> (raw)
In-Reply-To: <20240415033614.43518-1-lirongqing@baidu.com>
On Mon, 15 Apr 2024 04:36:14 +0100,
Li RongQing <lirongqing@baidu.com> wrote:
>
> per-CPU stack_page are dominantly accessed from their own local CPUs,
> so allocate them node-local to improve performance.
Do you have any performance data to back this up?
Given that this is only used in the non-VHE case, and that by doing so
you have left quite a lot of performance on the floor already, I'm
even more surprised to see the performance argument.
Furthermore, you don't address the allocation of per-CPU data, which
has a much larger potential impact, given how the HYP code is
structured.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> arch/arm64/kvm/arm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index c4a0a35..d745d01 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -2330,15 +2330,15 @@ static int __init init_hyp_mode(void)
> * Allocate stack pages for Hypervisor-mode
> */
> for_each_possible_cpu(cpu) {
> - unsigned long stack_page;
> + struct page *page;
>
> - stack_page = __get_free_page(GFP_KERNEL);
> - if (!stack_page) {
> + page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, 0);
> + if (!page) {
> err = -ENOMEM;
> goto out_err;
> }
>
> - per_cpu(kvm_arm_hyp_stack_page, cpu) = stack_page;
> + per_cpu(kvm_arm_hyp_stack_page, cpu) = page_address(page);
> }
>
> /*
The patch itself looks correct, however partial and lacking some
convincing data.
M.
--
Without deviation from the norm, progress is not possible.
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Li RongQing <lirongqing@baidu.com>
Cc: oliver.upton@linux.dev, james.morse@arm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
catalin.marinas@arm.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev
Subject: Re: [PATCH] KVM: arm64: Consider NUMA affinity when allocating per-CPU stack_page
Date: Mon, 15 Apr 2024 08:36:14 +0100 [thread overview]
Message-ID: <86bk6brsb5.wl-maz@kernel.org> (raw)
In-Reply-To: <20240415033614.43518-1-lirongqing@baidu.com>
On Mon, 15 Apr 2024 04:36:14 +0100,
Li RongQing <lirongqing@baidu.com> wrote:
>
> per-CPU stack_page are dominantly accessed from their own local CPUs,
> so allocate them node-local to improve performance.
Do you have any performance data to back this up?
Given that this is only used in the non-VHE case, and that by doing so
you have left quite a lot of performance on the floor already, I'm
even more surprised to see the performance argument.
Furthermore, you don't address the allocation of per-CPU data, which
has a much larger potential impact, given how the HYP code is
structured.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> arch/arm64/kvm/arm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index c4a0a35..d745d01 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -2330,15 +2330,15 @@ static int __init init_hyp_mode(void)
> * Allocate stack pages for Hypervisor-mode
> */
> for_each_possible_cpu(cpu) {
> - unsigned long stack_page;
> + struct page *page;
>
> - stack_page = __get_free_page(GFP_KERNEL);
> - if (!stack_page) {
> + page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, 0);
> + if (!page) {
> err = -ENOMEM;
> goto out_err;
> }
>
> - per_cpu(kvm_arm_hyp_stack_page, cpu) = stack_page;
> + per_cpu(kvm_arm_hyp_stack_page, cpu) = page_address(page);
> }
>
> /*
The patch itself looks correct, however partial and lacking some
convincing data.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-15 7:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 3:36 [PATCH] KVM: arm64: Consider NUMA affinity when allocating per-CPU stack_page Li RongQing
2024-04-15 3:36 ` Li RongQing
2024-04-15 7:36 ` Marc Zyngier [this message]
2024-04-15 7:36 ` Marc Zyngier
2024-04-18 6:53 ` Li,Rongqing
2024-04-18 6:53 ` Li,Rongqing
2024-04-18 9:03 ` Marc Zyngier
2024-04-18 9:03 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bk6brsb5.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lirongqing@baidu.com \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.