[CRIU] [PATCH 1/2] cgroups: Add ability to reuse precreated controllers and cgroups

Pavel Emelyanov xemul at parallels.com
Fri May 22 06:05:30 PDT 2015


On 05/22/2015 04:01 PM, Cyrill Gorcunov wrote:
> On Fri, May 22, 2015 at 03:37:56PM +0300, Pavel Emelyanov wrote:
>>>>
>>>> The current behavior is _not_ to fail if some cgroup exists, but to
>>>> take it as is w/o modifying its parameters and populate with tasks.
>>>
>>> No. current behaviour is to fail if some cgroup exist, so that's why
>>> I assigned "strict" as default mode, ie when --manage-cgroup passed
>>> it's the same as --manage-cgroup=strict
>>
>> prepare_cgroup_dirs()
>>                 if (fstatat(cg, paux, &st, 0) < 0) {
>>                         ...
>>                 } else {
>>                         if (e->n_properties > 0) {
>>                                 xfree(e->properties);
>>                                 e->properties = NULL;
>>                                 e->n_properties = 0;
>>                         }
>>                         pr_info("Determined dir %s already existed\n", paux);
>>                 }
>>
>> If directory already exists we just skip its options and go on.
> 
> That's subcgroups.

Huh? This code also makes top-level groups, no?

> Which I'm not sure how to propagate "strict" mode over
> so I didn't change this code. That said the modes currently provided
> are taking into account for toplevel cgroups only. Is it wrong?
> (because it's early patches lets choose a strategy which fits best)

Wait a second, let's imagine we're dumping an openvz container that lives
in cgroup "100" and it has one sub-group called "foo". Then in the images
there will be two cgroups -- "100" and "100/foo".

Currently on restore criu will try to mkdir("100") and mkdir("100/foo").
Whichever directory exists, criu will skip its properties restore and will
do restore otherwise. IOW two modes exist -- "mkdir && props" or "nothing".
We want to introduce the 3rd mode -- "props only", right?

-- Pavel


More information about the CRIU mailing list