mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 11:35:19 +00:00
qemu: Use the CPU index in capabilities to map NUMA node to cpu list.
On some of the NUMA platforms, the CPU index in each NUMA node grows non-consecutive. While on other platforms, it can be inconsecutive, E.g. % numactl --hardware available: 4 nodes (0-3) node 0 cpus: 0 4 8 12 16 20 24 28 node 0 size: 131058 MB node 0 free: 86531 MB node 1 cpus: 1 5 9 13 17 21 25 29 node 1 size: 131072 MB node 1 free: 127070 MB node 2 cpus: 2 6 10 14 18 22 26 30 node 2 size: 131072 MB node 2 free: 127758 MB node 3 cpus: 3 7 11 15 19 23 27 31 node 3 size: 131072 MB node 3 free: 127226 MB node distances: node 0 1 2 3 0: 10 20 20 20 1: 20 10 20 20 2: 20 20 10 20 3: 20 20 20 10 This patch is to fix the problem by using the CPU index in caps->host.numaCell[i]->cpus[i] to set the bitmask instead of assuming the CPU index of the NUMA nodes are always sequential. (cherry picked from commit d1bdeca875d92c6fe9c9eb854fa1f3d891fef84a)
This commit is contained in:
parent
d8a1c6b70c
commit
e88212d583
@ -1837,20 +1837,13 @@ qemuProcessInitCpuAffinity(struct qemud_driver *driver,
|
|||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
|
|
||||||
/* numad returns the NUMA node list, convert it to cpumap */
|
/* numad returns the NUMA node list, convert it to cpumap */
|
||||||
int prev_total_ncpus = 0;
|
|
||||||
for (i = 0; i < driver->caps->host.nnumaCell; i++) {
|
for (i = 0; i < driver->caps->host.nnumaCell; i++) {
|
||||||
int j;
|
int j;
|
||||||
int cur_ncpus = driver->caps->host.numaCell[i]->ncpus;
|
int cur_ncpus = driver->caps->host.numaCell[i]->ncpus;
|
||||||
if (nodemask[i]) {
|
if (nodemask[i]) {
|
||||||
for (j = prev_total_ncpus;
|
for (j = 0; j < cur_ncpus; j++)
|
||||||
j < cur_ncpus + prev_total_ncpus &&
|
VIR_USE_CPU(cpumap, driver->caps->host.numaCell[i]->cpus[j]);
|
||||||
j < maxcpu &&
|
|
||||||
j < VIR_DOMAIN_CPUMASK_LEN;
|
|
||||||
j++) {
|
|
||||||
VIR_USE_CPU(cpumap, j);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
prev_total_ncpus += cur_ncpus;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(nodemask);
|
VIR_FREE(nodemask);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user