Since Xen 4.5 the libxl allows to set affinities during domain creation.
This enables Xen to allocate the domain memory on NUMA nodes close to
the specified pcpus.
Remove the old approach, which moved vcpus after Xen had already allocated
domain memory.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/libxl/libxl_domain.c | 46 ----------------------------------------
src/libxl/libxl_domain.h | 4 ----
2 files changed, 50 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index d78765ad84..625e04a9b0 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -967,49 +967,6 @@ libxlDomainAutoCoreDump(libxlDriverPrivate *driver,
return 0;
}
-int
-libxlDomainSetVcpuAffinities(libxlDriverPrivate *driver, virDomainObj *vm)
-{
- g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
- virDomainVcpuDef *vcpu;
- libxl_bitmap map;
- virBitmap *cpumask = NULL;
- size_t i;
- int ret = -1;
-
- libxl_bitmap_init(&map);
-
- for (i = 0; i < virDomainDefGetVcpus(vm->def); ++i) {
- vcpu = virDomainDefGetVcpu(vm->def, i);
-
- if (!vcpu->online)
- continue;
-
- if (!(cpumask = vcpu->cpumask))
- cpumask = vm->def->cpumask;
-
- if (!cpumask)
- continue;
-
- if (virBitmapToData(cpumask, &map.map, (int *)&map.size) < 0)
- goto cleanup;
-
- if (libxl_set_vcpuaffinity(cfg->ctx, vm->def->id, i, &map, NULL) !=
0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to pin vcpu '%zu' with
libxenlight"), i);
- goto cleanup;
- }
-
- libxl_bitmap_dispose(&map); /* Also returns to freshly-init'd state */
- }
-
- ret = 0;
-
- cleanup:
- libxl_bitmap_dispose(&map);
- return ret;
-}
-
static int
libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config)
{
@@ -1460,9 +1417,6 @@ libxlDomainStart(libxlDriverPrivate *driver,
goto destroy_dom;
}
- if (libxlDomainSetVcpuAffinities(driver, vm) < 0)
- goto destroy_dom;
-
if (!start_paused) {
libxlDomainUnpauseWrapper(cfg->ctx, domid);
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index cbe7ba19ba..928ee8f5cd 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -124,10 +124,6 @@ int
libxlDomainAutoCoreDump(libxlDriverPrivate *driver,
virDomainObj *vm);
-int
-libxlDomainSetVcpuAffinities(libxlDriverPrivate *driver,
- virDomainObj *vm);
-
int
libxlDomainStartNew(libxlDriverPrivate *driver,
virDomainObj *vm,