mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
lxc_controller: Use automatic memory freeing for virBitmap
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9566576c02
commit
94490b59f1
@ -731,7 +731,7 @@ static int virLXCControllerSetupLoopDevices(virLXCController *ctrl)
|
|||||||
static int virLXCControllerSetupCpuAffinity(virLXCController *ctrl)
|
static int virLXCControllerSetupCpuAffinity(virLXCController *ctrl)
|
||||||
{
|
{
|
||||||
int hostcpus, maxcpu = CPU_SETSIZE;
|
int hostcpus, maxcpu = CPU_SETSIZE;
|
||||||
virBitmap *cpumap;
|
g_autoptr(virBitmap) cpumap = NULL;
|
||||||
virBitmap *cpumapToSet;
|
virBitmap *cpumapToSet;
|
||||||
|
|
||||||
VIR_DEBUG("Setting CPU affinity");
|
VIR_DEBUG("Setting CPU affinity");
|
||||||
@ -761,11 +761,8 @@ static int virLXCControllerSetupCpuAffinity(virLXCController *ctrl)
|
|||||||
* so use '0' to indicate our own process ID. No threads are
|
* so use '0' to indicate our own process ID. No threads are
|
||||||
* running at this point
|
* running at this point
|
||||||
*/
|
*/
|
||||||
if (virProcessSetAffinity(0 /* Self */, cpumapToSet, false) < 0) {
|
if (virProcessSetAffinity(0 /* Self */, cpumapToSet, false) < 0)
|
||||||
virBitmapFree(cpumap);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
virBitmapFree(cpumap);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -810,7 +807,7 @@ static int virLXCControllerGetNumadAdvice(virLXCController *ctrl,
|
|||||||
*/
|
*/
|
||||||
static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
||||||
{
|
{
|
||||||
virBitmap *auto_nodeset = NULL;
|
g_autoptr(virBitmap) auto_nodeset = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virBitmap *nodeset = NULL;
|
virBitmap *nodeset = NULL;
|
||||||
virDomainNumatuneMemMode mode;
|
virDomainNumatuneMemMode mode;
|
||||||
@ -841,7 +838,6 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virBitmapFree(auto_nodeset);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -852,7 +848,7 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
|||||||
*/
|
*/
|
||||||
static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
||||||
{
|
{
|
||||||
virBitmap *auto_nodeset = NULL;
|
g_autoptr(virBitmap) auto_nodeset = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virBitmap *nodeset = NULL;
|
virBitmap *nodeset = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -884,7 +880,6 @@ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virBitmapFree(auto_nodeset);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user