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

Pavel Emelyanov xemul at parallels.com
Fri May 22 05:37:56 PDT 2015


On 05/22/2015 03:26 PM, Cyrill Gorcunov wrote:
> On Fri, May 22, 2015 at 03:10:01PM +0300, Pavel Emelyanov wrote:
>> On 05/22/2015 03:03 PM, Cyrill Gorcunov wrote:
>>> On Fri, May 22, 2015 at 02:53:22PM +0300, Pavel Emelyanov wrote:
>>>> On 05/21/2015 10:33 PM, Cyrill Gorcunov wrote:
>>>>> When been playing wich checkpoint/restore of container I found
>>>>> that we can't reuse existing controller if they were pre-created.
>>>>> For example currently in PCS7 we're bindmount cgroups which belong
>>>>> to a container in a form of
>>>>>
>>>>>  /sys/fs/cgroup/<controller>/<container> ==> /sys/fs/cgroup/<controller>
>>>>>
>>>>> so that CRIU dumps such configuration fine but on restore
>>>>> it recreates controllers from the scratch which we would
>>>>> like to bindmount them and ask CRIU to restore subcgroups
>>>>> and their parameters.
>>>>>
>>>>> So I extended --manage-cgroups option to take <mode> arguments
>>>>> which might be
>>>>>
>>>>>  - strict: default mode -- no change in current behaviour,
>>>>>    we restore everything from the scratch failing with error
>>>>>    if some toplevel controller or cgroup already exist
>>>>
>>>> What do you mean by "default"? The mode when --mange-cgroups is
>>>> specified, but "mode" (argument) is not?
>>>
>>> Yes. To keep backward compatibility.
>>
>> 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.

>>>> I see that modes can be OR-ed. What do the combinations mean?
>>>
>>> At the momen it doesn't do anything useful, because there are
>>> only plain tests when we're handling cgroups (ie most relaxed
>>> mode is tested first). But I think we might extend the semantics
>>> in future that's where OR came from.
>>
>> OK, but maybe we should override modes with newer ones instead of
>> silently "not doing anything useful"?
> 
> You mean in option's parsing routine? If so, sure we can.

Thanks :)



More information about the CRIU mailing list