Re: [PATCH] cgroup-v1: freezer: optionally killable freezer

From: Marco Ballesio
Date: Fri Mar 20 2020 - 16:10:48 EST


On Wed, Mar 11, 2020 at 10:46:15AM -0700, Daniel Colascione wrote:
> On Tue, Mar 3, 2020 at 5:48 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
> >
> > Hello,
> >
> > On Wed, Feb 19, 2020 at 10:32:31AM -0800, Marco Ballesio wrote:
> > > @@ -94,6 +94,18 @@ The following cgroupfs files are created by cgroup freezer.
> > > Shows the parent-state. 0 if none of the cgroup's ancestors is
> > > frozen; otherwise, 1.
> > >
> > > +* freezer.killable: Read-write
> > > +
> > > + When read, returns the killable state of a cgroup - "1" if frozen
> > > + tasks will respond to fatal signals, or "0" if they won't.
> > > +
> > > + When written, this property sets the killable state of the cgroup.
> > > + A value equal to "1" will switch the state of all frozen tasks in
> > > + the cgroup to TASK_INTERRUPTIBLE (similarly to cgroup v2) and will
> > > + make them react to fatal signals. A value of "0" will switch the
> > > + state of frozen tasks to TASK_UNINTERRUPTIBLE and they won't respond
> > > + to signals unless thawed or unfrozen.
> >
> > As Roman said, I'm not too sure about adding a new cgroup1 freezer
> > interface at this point. If we do this, *maybe* a mount option would
> > be more minimal?
>
> I'd still prefer a cgroup flag. A mount option is a bigger
> compatibility risk and isn't really any simpler than another cgroup
> flag. A mount option will affect anything using the cgroup mount
> point, potentially turning non-killable frozen processes into killable
> ones unexpectedly. (Sure, you could mount multiple times, but only one
> location is canonical, and that's the one that's going to get the flag
> flipped.) A per-cgroup flag allows people to opt into the new behavior
> only in specific contexts, so it's safer.

It might also be desirable for userland to have a way to modify the behavior of
an already mounted v1 freezer.

Tejun, would it be acceptable to have a flag but disable it by default, hiding
it behind a kernel configuration option?