diff options
author | Hu Tao <hutao@cn.fujitsu.com> | 2012-09-14 15:47:01 +0800 |
---|---|---|
committer | Laine Stump <laine@laine.org> | 2012-09-17 14:59:37 -0400 |
commit | ee7d23ba4b4d487f8ac078c66b743d93a24141c0 (patch) | |
tree | a0aa24e1c2d04cbac0a5ca21889985c796eef684 /src/lxc | |
parent | use virBitmap to store numa nodemask info. (diff) | |
download | libvirt-ee7d23ba4b4d487f8ac078c66b743d93a24141c0.tar.gz libvirt-ee7d23ba4b4d487f8ac078c66b743d93a24141c0.tar.bz2 libvirt-ee7d23ba4b4d487f8ac078c66b743d93a24141c0.zip |
use virBitmap to store cpumask info.
Diffstat (limited to 'src/lxc')
-rw-r--r-- | src/lxc/lxc_controller.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 44ec7aa4a..7e9800623 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -490,9 +490,9 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl) */ static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl) { - int i, hostcpus, maxcpu = CPU_SETSIZE; + int hostcpus, maxcpu = CPU_SETSIZE; virNodeInfo nodeinfo; - virBitmapPtr cpumap; + virBitmapPtr cpumap, cpumapToSet; VIR_DEBUG("Setting CPU affinity"); @@ -509,12 +509,10 @@ static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl) if (!cpumap) return -1; + cpumapToSet = cpumap; + if (ctrl->def->cpumask) { - /* XXX why don't we keep 'cpumask' in the libvirt cpumap - * format to start with ?!?! */ - for (i = 0 ; i < maxcpu && i < ctrl->def->cpumasklen ; i++) - if (ctrl->def->cpumask[i]) - ignore_value(virBitmapSetBit(cpumap, i)); + cpumapToSet = ctrl->def->cpumask; } else { /* You may think this is redundant, but we can't assume libvirtd * itself is running on all pCPUs, so we need to explicitly set @@ -527,7 +525,7 @@ static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl) * so use '0' to indicate our own process ID. No threads are * running at this point */ - if (virProcessInfoSetAffinity(0 /* Self */, cpumap) < 0) { + if (virProcessInfoSetAffinity(0 /* Self */, cpumapToSet) < 0) { virBitmapFree(cpumap); return -1; } |