[libvirt] [PATCH 4/5] util: vircgroupv2: enable CPU controller only if it's available

Pavel Hrdina posted 5 patches 6 years, 7 months ago
There is a newer version of this series
[libvirt] [PATCH 4/5] util: vircgroupv2: enable CPU controller only if it's available
Posted by Pavel Hrdina 6 years, 7 months ago
It might happen that we are not able to enable CPU controller so we
can enable it for thread sub-cgroups only if it's available in parent
cgroup.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/util/vircgroupv2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index f3a119b689..6eeebe2230 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -404,7 +404,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
                 return -1;
             }
 
-            if (virCgroupV2EnableController(parent,
+            if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
+                virCgroupV2EnableController(parent,
                                             VIR_CGROUP_CONTROLLER_CPU) < 0) {
                 return -1;
             }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/5] util: vircgroupv2: enable CPU controller only if it's available
Posted by Ján Tomko 6 years, 7 months ago
On Thu, Jun 20, 2019 at 01:25:44PM +0200, Pavel Hrdina wrote:
>It might happen that we are not able to enable CPU controller so we
>can enable it for thread sub-cgroups only if it's available in parent
>cgroup.
>
>Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>---
> src/util/vircgroupv2.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list