From b02e20f12e4faa07d4fba741337921968d901e9d Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 6 Dec 2019 15:39:54 +0900 Subject: [PATCH] cgroup2: enable controllers automatically Signed-off-by: Akihiro Suda --- runtime/v2/runc/v2/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runtime/v2/runc/v2/service.go b/runtime/v2/runc/v2/service.go index 05f9347e7..fccede15b 100644 --- a/runtime/v2/runc/v2/service.go +++ b/runtime/v2/runc/v2/service.go @@ -336,7 +336,14 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI. logrus.WithError(err).Error("add cg to OOM monitor") } case *cgroupsv2.Manager: - // TODO: enable controllers for statting + allControllers, err := cg.RootControllers() + if err != nil { + logrus.WithError(err).Error("failed to get root controllers") + } else { + if err := cg.ToggleControllers(allControllers, cgroupsv2.Enable); err != nil { + logrus.WithError(err).Errorf("failed to enable controllers (%v)", allControllers) + } + } // OOM monitor is not implemented yet logrus.WithError(errdefs.ErrNotImplemented).Warn("add cg to OOM monitor")