Skip to content

Commit

Permalink
Revert "util: vircgroup: pass parent cgroup into virCgroupDetectContr…
Browse files Browse the repository at this point in the history
…ollersCB"

This reverts commit 7bca1c9.

As it turns out it's not a good idea on systemd hosts.  The root
cgroup can have all controllers enabled but they don't have to be
enabled for sub-cgroups.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
  • Loading branch information
phrdina committed Jun 28, 2019
1 parent bd17012 commit d117431
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/util/vircgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ virCgroupDetect(virCgroupPtr group,

for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
if (group->backends[i]) {
int rc = group->backends[i]->detectControllers(group, controllers, parent);
int rc = group->backends[i]->detectControllers(group, controllers);
if (rc < 0)
return -1;
controllersAvailable |= rc;
Expand Down
3 changes: 1 addition & 2 deletions src/util/vircgroupbackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ typedef char *

typedef int
(*virCgroupDetectControllersCB)(virCgroupPtr group,
int controllers,
virCgroupPtr parent);
int controllers);

typedef bool
(*virCgroupHasControllerCB)(virCgroupPtr cgroup,
Expand Down
3 changes: 1 addition & 2 deletions src/util/vircgroupv1.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)

static int
virCgroupV1DetectControllers(virCgroupPtr group,
int controllers,
virCgroupPtr parent ATTRIBUTE_UNUSED)
int controllers)
{
size_t i;
size_t j;
Expand Down
17 changes: 6 additions & 11 deletions src/util/vircgroupv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,16 @@ virCgroupV2ParseControllersFile(virCgroupPtr group)

static int
virCgroupV2DetectControllers(virCgroupPtr group,
int controllers,
virCgroupPtr parent)
int controllers)
{
size_t i;

if (parent) {
group->unified.controllers = parent->unified.controllers;
} else {
if (virCgroupV2ParseControllersFile(group) < 0)
return -1;
if (virCgroupV2ParseControllersFile(group) < 0)
return -1;

/* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
* exists with usage stats. */
group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
}
/* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
* exists with usage stats. */
group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;

if (controllers >= 0)
group->unified.controllers &= controllers;
Expand Down

0 comments on commit d117431

Please sign in to comment.