From: Li RongQing <lirongqing@baidu.com>
To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, x86@kernel.org, linux-hyperv@vger.kernel.org
Cc: Li RongQing <lirongqing@baidu.com>
Subject: [PATCH] x86/hyperv: Consider NUMA affinity when allocating memory for per-CPU vmsa
Date: Mon, 15 Apr 2024 16:57:12 +0800 [thread overview]
Message-ID: <20240415085712.49980-1-lirongqing@baidu.com> (raw)
per-CPU vmsa are dominantly accessed from their own local CPUs,
so allocate them node-local to improve performance.
And reorganized variables to be reverse christmas tree order
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
arch/x86/hyperv/ivm.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
index 768d73d..5bc2430 100644
--- a/arch/x86/hyperv/ivm.c
+++ b/arch/x86/hyperv/ivm.c
@@ -291,16 +291,18 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa)
int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
{
- struct sev_es_save_area *vmsa = (struct sev_es_save_area *)
- __get_free_page(GFP_KERNEL | __GFP_ZERO);
+ struct hv_enable_vp_vtl *start_vp_input;
struct sev_es_save_area *cur_vmsa;
+ struct sev_es_save_area *vmsa;
struct desc_ptr gdtr;
- u64 ret, retry = 5;
- struct hv_enable_vp_vtl *start_vp_input;
unsigned long flags;
+ u64 ret, retry = 5;
+ struct page *p;
- if (!vmsa)
+ p = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_ZERO, 0);
+ if (!p)
return -ENOMEM;
+ vmsa = (struct sev_es_save_area *)page_address(p);
native_store_gdt(&gdtr);
--
2.9.4
next reply other threads:[~2024-04-15 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 8:57 Li RongQing [this message]
2024-04-22 22:28 ` [PATCH] x86/hyperv: Consider NUMA affinity when allocating memory for per-CPU vmsa Wei Liu
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=20240415085712.49980-1-lirongqing@baidu.com \
--to=lirongqing@baidu.com \
--cc=bp@alien8.de \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).