Skip to content

Commit b02e20f

Browse files
committed
cgroup2: enable controllers automatically
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent 8f870c2 commit b02e20f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

runtime/v2/runc/v2/service.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,14 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
336336
logrus.WithError(err).Error("add cg to OOM monitor")
337337
}
338338
case *cgroupsv2.Manager:
339-
// TODO: enable controllers for statting
339+
allControllers, err := cg.RootControllers()
340+
if err != nil {
341+
logrus.WithError(err).Error("failed to get root controllers")
342+
} else {
343+
if err := cg.ToggleControllers(allControllers, cgroupsv2.Enable); err != nil {
344+
logrus.WithError(err).Errorf("failed to enable controllers (%v)", allControllers)
345+
}
346+
}
340347

341348
// OOM monitor is not implemented yet
342349
logrus.WithError(errdefs.ErrNotImplemented).Warn("add cg to OOM monitor")

0 commit comments

Comments
 (0)