[CRIU] [PATCH 2/2] cgroups: Introduce cgroup management modes

Pavel Emelyanov xemul at parallels.com
Tue Jun 2 09:24:15 PDT 2015


On 06/02/2015 06:50 PM, Cyrill Gorcunov wrote:
> On Tue, Jun 02, 2015 at 06:33:34PM +0300, Pavel Emelyanov wrote:
>>
>>> @@ -211,8 +211,22 @@ Restores previously checkpointed processes.
>>>  *-r*, *--root* '<path>'::
>>>      Change the root filesystem to <path> (when run in mount namespace).
>>>  
>>> -*--manage-cgroups*::
>>> -    Restore cgroups configuration associated with a task from the image.
>>> +*--manage-cgroups* [<mode>,<mode>]::
>>> +     Restore cgroups configuration associated with a task from the image.
>>> +     '<mode>' may be a combination of keywords from below.
>>
>> CRIU can do two things with each cgroup -- create one and restore properties in.
>>
>>> +    - *lazy*.     Require all controller roots to be created from image, and
>>> +                  in case if some cgroup is already present the appropriate
>>> +                  properties are zapped. This is default mode, same as setting
>>> +                  up the option without arguments.
>>
>> This is current behavior.
>> 	if cgruop doesn't exist -- do both
>> 	if cgroup does exists -- do none
> 
> yes
> 
>>> +    - *bindroot*. Require controller to exist before restore. This is useful
>>> +                  if some other tool precreates cgroup roots for us.
>>
>> This one looks like
>> 	if cgroup doesn't exist -- fail
>> 	if cgroup does exists -- do none
> 
> yes, but bindroot might be combined with props.
> 
>>
>>> +    - *props*.    If controller do not exist it will be cretaed from image,
>>
>> s/cretaed/created/
> 
> thanks
> 
>>
>>> +                  otherwise reuse existing one. In case if cgroup exist
>>> +                  properties are not zapped (as in *lazy* mode) but still
>>> +                  restored from the image.
>>
>> This is
>> 	if cgroup doesn't exist -- do both
>> 	if cgroup does exist -- do props restore
>>
>> Right?
> 
> yes
> .
> 

OK, so we have 3 options for 2 objects. 3 for cgroups -- must be there
(like 0 flags for open); may be there. create otherwise (O_CREAT for open);
should not be there, create new (O_CREAT|O_EXCL). 3 for props -- always 
restore, maybe restore (if created), don't restore. I.e. -- 9 behaviors.

cgroup     props
0          always
0          maybe      -- this is "dont", directory is expected to be there
0          dont

O_CREAT    always     -- this is what we need for openvz
O_CREAT    maybe      -- this is current behavior
O_CREAT    dont       -- this is stupid :) default props for created cgroup is not nice

O_EXCL     always
O_EXCL     maybe      -- this is "always" -- directory is created or restore fails
O_EXCL     dont       -- this is stupid just as O_CREAT + dont

So after cleaning this list out left things are

0          always     -- need cgroups and overwrite props
0          dont       -- need cgroups with good props
O_CREAT    always     -- this is what we need for openvz
O_CREAT    maybe      -- this is current behavior
O_EXCL     always     -- strict fresh new restore

What are the combinations of lazy, bindroot and props for those? And -- can we
have some more meaningful names for it? And -- do we need separate options for
mkdir/props for root and non-root cgroups?

-- Pavel


More information about the CRIU mailing list