xen/sched: Re-position the domain_update_node_affinity() call during vcpu construction
PATCH 1/1 xen/sched: Re-position the domain_update_node_affinity() call during vcpu construction
alloc_vcpu()'s call to domain_update_node_affinity() has existed for a decade, but its effort is mostly wasted.
alloc_vcpu() is called in a loop for each vcpu, bringing them into existence. The values of the affinity masks are still default, which is allcpus in general, or a processor singleton for pinned domains.
Furthermore, domain_update_node_affinity() itself loops over all vcpus accumulating the masks, making it a scalability concern with large numbers of vcpus.
Move it to be called once after all vcpus are constructed, which has the same net effect, but with fewer intermediate memory allocations and less cpumask arithmetic.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Dario Faggioli <[email protected]>
This perhaps wants backporting to the maintenance trees, which is why I've rebased it backwards over my other construction changes.
--- xen/arch/arm/domain_build.c | 2 ++ xen/arch/x86/hvm/dom0_build.c | 2 ++ xen/arch/x86/pv/dom0_build.c | 1 + xen/common/domain.c | 3 --- xen/common/domctl.c | 1 + 5 files changed, 6 insertions(+), 3 deletions(-)
xen/arch/arm/domain_build.c +2 -0
@@ -2242,6 +2242,8 @@ int __init construct_dom0(struct domain *d)vcpu_switch_to_aarch64_mode (d->vcpu[i]); } +domain_update_node_affinity (d); + v->is_initialised =1 ;clear_bit (_VPF_down, &v->pause_flags);
xen/arch/x86/hvm/dom0_build.c +2 -0
@@ -600,6 +600,8 @@ static int __init pvh_setup_cpus(struct domain *d, paddr_t entry, cpu = p->processor; } +domain_update_node_affinity (d); + rc =arch_set_info_hvm_guest (v, &cpu_ctx);if ( rc ) {
xen/arch/x86/pv/dom0_build.c +1 -0
@@ -709,6 +709,7 @@ int __init dom0_construct_pv(struct domain *d, cpu = p->processor; } +domain_update_node_affinity (d); d->arch.paging.mode =0 ;/* Set up CR3 value for write_ptbase */
xen/common/domain.c +0 -3
@@ -193,9 +193,6 @@ struct vcpu *alloc_vcpu(/* Must be called after making new vcpu visible to for_each_vcpu(). */ vcpu_check_shutdown (v); -if ( !is_idle_domain (d) ) -domain_update_node_affinity (d); -return v; }
xen/common/domctl.c +1 -0
@@ -590,6 +590,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) goto maxvcpu_out; } +domain_update_node_affinity (d); ret =0 ; maxvcpu_out:
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.09.18 at 16:01, <[email protected]> wrote:
alloc_vcpu()'s call to
domain_update_node_affinity()has existed for a decade, but its effort is mostly wasted.
alloc_vcpu()is called in a loop for each vcpu, bringing them into existence. The values of the affinity masks are still default, which is allcpus in general, or a processor singleton for pinned domains.Furthermore,
domain_update_node_affinity()itself loops over all vcpus accumulating the masks, making it a scalability concern with large numbers of vcpus.
Quoted 5 lines
Move it to be called once after all vcpus are constructed, which has the same net effect, but with fewer intermediate memory allocations and less cpumask arithmetic.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Andrew Cooper
alloc_vcpu()'s call to
domain_update_node_affinity()has existed for a decade, but its effort is mostly wasted.
alloc_vcpu()is called in a loop for each vcpu, bringing them into existence. The values of the affinity masks are still default, which is allcpus in general, or a processor singleton for pinned domains.Furthermore,
domain_update_node_affinity()itself loops over all vcpus accumulating the masks, making it a scalability concern with large numbers of vcpus.
Quoted 5 lines
Move it to be called once after all vcpus are constructed, which has the same net effect, but with fewer intermediate memory allocations and less cpumask arithmetic.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Andrew,
Quoted 11 lines · Andrew Cooper
alloc_vcpu()'s call to
domain_update_node_affinity()has existed for a decade, but its effort is mostly wasted.
alloc_vcpu()is called in a loop for each vcpu, bringing them into existence. The values of the affinity masks are still default, which is allcpus in general, or a processor singleton for pinned domains.Furthermore,
domain_update_node_affinity()itself loops over all vcpus accumulating the masks, making it a scalability concern with large numbers of vcpus.
Quoted 5 lines
Move it to be called once after all vcpus are constructed, which has the same net effect, but with fewer intermediate memory allocations and less cpumask arithmetic.
Signed-off-by Andrew Cooper <[email protected]>
For Arm bits:
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Andrew Cooper
alloc_vcpu()'s call to
domain_update_node_affinity()has existed for a decade,
but its effort is mostly wasted.
alloc_vcpu()is called in a loop for each vcpu, bringing them into existence.
The values of the affinity masks are still default, which is allcpus in
general, or a processor singleton for pinned domains.Furthermore,
domain_update_node_affinity()itself loops over all vcpus
accumulating the masks, making it a scalability concern with large numbers of
vcpus.
Quoted 8 lines
Move it to be called once after all vcpus are constructed, which has the same
net effect, but with fewer intermediate memory allocations and less cpumask
arithmetic.Signed-off-by Andrew Cooper <[email protected]>
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Software Engineer @ SUSE https://www.suse.com/
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel