Re: [RFC] cgroups: freezer -- Allow to attach a task to a frozencgroup

From: Tejun Heo
Date: Mon Nov 28 2011 - 11:08:51 EST


On Mon, Nov 28, 2011 at 04:08:13PM +0400, Cyrill Gorcunov wrote:
> In checkpoint/restore we need an ability to attach pids to
> a frozen cgroup. Thus once pid reaches a frozen cgroup it is
> not rejected, but the task get frozen immediately.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> ---
>
> I would really appreciate complains and comments.

First of all, both freezer and cgroup have non-trivial pending
patchsets (e.g. ->can_attach_task() is scheduled for removal) and I
have changes which basically try to achieve about the same thing, so
let's slow down a bit. I think the problem is a bit more complex.

Some thoughts I have on cgroup freezer ATM,

* Currently, FROZEN -> FREEZING transition isn't possible. That's why
event transition detection by polling is acceptable. ie. once the
state is polled to be FROZEN, it stays frozen. Allowing FREEZING ->
FROZEN transition would probably require improvements to state
transition notification too, at the very least, clarification of
rules.

* There are some unclear corner cases and bugs the current cgroup
freezer has. e.g. behavior w.r.t. kthreads is outright buggy. It
would be great to figure out how to deal with them with or before
this change (ie. what happens when you transfer unfreezable
kthreads).

* A pending feature request is making the freezing action atomically
recursive. We'll probably need to add a param to allow choosing
which behavior to take.

* Another improvement that I want to have is allowing cgroup frozen
tasks to be killed. I don't think this matters for system freezer
but for cgroup freezer both oom killer and systemd want it.

So, while I agree with the direction of this patch, I think this
definitely needs a lot more work to go in. I don't think we can do
much until the freezer and cgroup changes are settled. The freezer
part is now in Rafael's tree, the cgroup part is going under Linus'
review. Once they're complete, I'll provide a merged branch that
further cgroup works can be based on.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/