[CRIU] [PATCH 1/2] Re-create cgroups if necessary

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jun 27 06:24:47 PDT 2014


Quoting Pavel Emelyanov (xemul at parallels.com):
> On 06/26/2014 10:46 PM, Saied Kazemi wrote:
> > Pavel,
> > 
> > Just a quick follow up:
> > 
> >> 1. cgroups sub-hierarchy
> >> 2. configuration of cgroups
> >> 3. populating cgroups with tasks
> >> 4. creating cgroup mountpoints (if any)
> > 
> > Pertaining to the list above, one of our interns is working on #2 and will probably
> > have a patch in a month.  Please let me know if someone is already working on this 
> > to avoid duplication of effort.
> 
> Cool! From Parallels, only me was about to look into this, but since you have
> started -- I will switch to other tasks :)
> 
> >> With a CLI option we tell CRIU:
> >>
> >> 1. Expect the cgroup to already exist, just put the process back in it.  If cgroup doesn't exist, fail.
> >> 2. Expect the cgroup not to exist, create it and put the process in it.  If cgroup exists, fail.
> > 
> > I was wondering if you had a chance to think about this.  As explained before, there 
> > are legitimate cases where the cgroups do already exist prior to criu restore, so their
> > absence is a definite error.  Also, there are legitimate cases where the cgroups do
> > not already exist prior to criu restore, so CRIU should create them.  CRIU on its own
> > cannot determine which scenario it's dealing with.  We can make the default action to
> > always create cgroups, but we still need a mechanism to tell it otherwise.
> 
> And, as Serge mentioned, there are cases when we would want to change the top-most
> cgroup path on restore.
> 
> Right now I have this model in my head:
> 
> 1. On dump get the paths to cgroups where the container's init process lives
>    and dump all the other cgroup paths as relative to this one.
> 
> 2. On restore introduce the --cgroup-root $path option that will prepend the $path
>    to every cgroup being used -- for creation of them and for moving tasks into.
> 
> and taking into account the exist/not-exist issues
> 
> 3. On restore introduce the --cgroup-create 'yes|no|may', where 'yes' allows to
>    create missing cgroups and _don't_ use existing (abort restore if mkdir reports
>    EEXISTS), 'no' denies creation of cgroups and abort the restore if smth is 
>    missing and 'may' means create what is necessary or use existing if they exist.
> 
> What do you think about it? Serge, correct me if I've mixed up something in the 
> items 1 and 2.

No, sounds good, thanks.  The only thing I'd add is that if doing
--cgroup-create=yes, while criu would not create the root cgroup, it
should still configure it.

-serge


More information about the CRIU mailing list