xen/sched: Re-position the domain_update_node_affinity() call during vcpu construction
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 6 Sep 2018 13:40:56 +0000 (14:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 11 Sep 2018 16:34:35 +0000 (17:34 +0100)
commit1dfb8e6e0948912d1fd96d6ed9034527c5c74f31
tree022ae2b3a068149916f13569b8cd5987680fb5b5
parent8ca88879110ecfebed6e36612ae72ef284c270cd
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 quadratic with the number 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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
xen/arch/arm/domain_build.c
xen/arch/x86/hvm/dom0_build.c
xen/arch/x86/pv/dom0_build.c
xen/common/domain.c
xen/common/domctl.c