Message ID | 20250417085302.2554018-1-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | xen/percpu: NUMA-position the per-CPU area | expand |
On 17.04.2025 10:53, Andrew Cooper wrote: > This seems to have been quite an oversite in Xen's NUMA support, albeit it Nit: oversight? > probably because NUMA was arch-specific at first. > > Take the opportunity to sort the includes. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> > For the !NUMA case, cpu_to_node() defaults to 0 rather than NUMA_NO_NODE, > making memflags nonzero. I'm not sure how wise this is, but ARM runs seem > happy with it. As to Arm: May be worth noting in the commit message that this is unlikely to have any useful effect when SEPARATE_XENHEAP=y. I guess our only option to address that (if any Arm32 NUMA systems exist) would be to use vmap(). Jan
diff --git a/xen/common/percpu.c b/xen/common/percpu.c index c6ecd95a0874..cdd70acbeaf3 100644 --- a/xen/common/percpu.c +++ b/xen/common/percpu.c @@ -1,8 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include <xen/percpu.h> #include <xen/cpu.h> #include <xen/init.h> #include <xen/mm.h> +#include <xen/numa.h> +#include <xen/percpu.h> #include <xen/rcupdate.h> #include <xen/sections.h> @@ -27,6 +28,8 @@ void __init percpu_init_areas(void) static int init_percpu_area(unsigned int cpu) { + nodeid_t node = cpu_to_node(cpu); + unsigned int memflags = node != NUMA_NO_NODE ? MEMF_node(node) : 0; char *p; if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA ) @@ -34,7 +37,7 @@ static int init_percpu_area(unsigned int cpu) ? 0 : -EBUSY; - if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL ) + if ( (p = alloc_xenheap_pages(PERCPU_ORDER, memflags)) == NULL ) return -ENOMEM; memset(p, 0, __per_cpu_data_end - __per_cpu_start);
This seems to have been quite an oversite in Xen's NUMA support, albeit it probably because NUMA was arch-specific at first. Take the opportunity to sort the includes. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Anthony PERARD <anthony.perard@vates.tech> CC: Michal Orzel <michal.orzel@amd.com> CC: Jan Beulich <jbeulich@suse.com> CC: Julien Grall <julien@xen.org> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/1773336913 For the !NUMA case, cpu_to_node() defaults to 0 rather than NUMA_NO_NODE, making memflags nonzero. I'm not sure how wise this is, but ARM runs seem happy with it. --- xen/common/percpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) base-commit: 7f8c2dd829358406dc9e50d5e386e4d2b20b4303