From fc840f199fd1fd53ab228cb72cd3daebbf725873 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 27 Mar 2020 10:44:59 -0700 Subject: [PATCH] cgroupv2: don't use GetCgroupMounts for criu c/r When performing checkpoint or restore of cgroupv2 unified hierarchy, there is no need to call getCgroupMounts() / cgroups.GetCgroupMounts() as there's only a single mount in there. This eliminates the last internal (i.e. runc) use case of cgroups.GetCgroupMounts() for v2 unified. Unfortunately, there are external ones (e.g. moby/moby) so we can't yet let it return an error. Signed-off-by: Kir Kolyshkin --- libcontainer/container_linux.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index aa150244..a6462378 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -1093,6 +1093,11 @@ func (c *linuxContainer) Checkpoint(criuOpts *CriuOpts) error { case "bind": c.addCriuDumpMount(req, m) case "cgroup": + if cgroups.IsCgroup2UnifiedMode() { + c.addCriuDumpMount(req, m) + continue + } + // cgroup v1 binds, err := getCgroupMounts(m) if err != nil { return err @@ -1357,6 +1362,11 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error { case "bind": c.addCriuRestoreMount(req, m) case "cgroup": + if cgroups.IsCgroup2UnifiedMode() { + c.addCriuRestoreMount(req, m) + continue + } + // cgroup v1 binds, err := getCgroupMounts(m) if err != nil { return err