aboutsummaryrefslogtreecommitdiff
path: root/src/lxc
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2012-09-14 15:47:01 +0800
committerLaine Stump <laine@laine.org>2012-09-17 14:59:37 -0400
commitee7d23ba4b4d487f8ac078c66b743d93a24141c0 (patch)
treea0aa24e1c2d04cbac0a5ca21889985c796eef684 /src/lxc
parentuse virBitmap to store numa nodemask info. (diff)
downloadlibvirt-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.c14
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;
}