linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Roman Gushchin <guroan@gmail.com>, Tejun Heo <tj@kernel.org>,
	Kernel Team <Kernel-team@fb.com>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v8 0/7] freezer for cgroup v2
Date: Wed, 20 Feb 2019 22:00:27 +0000	[thread overview]
Message-ID: <20190220220020.GA16335@castle.DHCP.thefacebook.com> (raw)
In-Reply-To: <20190220143748.GA9477@redhat.com>

On Wed, Feb 20, 2019 at 03:37:48PM +0100, Oleg Nesterov wrote:
> On 02/19, Roman Gushchin wrote:
> >
> > It provides similar functionality as v1 freezer, but the interface
> > conforms to the cgroup v2 interface design principles, and it
> > provides a better user experience: tasks can be killed, ptrace works,
> 
> I tried to not argue with intent, but to be honest I am more and more
> sceptical... Lets forget about ptrace for the moment.
> 
> Once again, why do we want a killable freezer?
> 
> If a user wants to kill a frozen task from CGRP_FROZEN cgroup he can simply
> 
> 	1. send SIGKILL to that task
> 
> 	2. migrate it to the root cgroup.
> 
> why this doesn't / can't work?

It does work, but it doesn't look as a nice interface to take into
the cgroup v2 world.

It just not clear, why killing a frozen task requires some cgroup-level
operations? It doesn't add anything except some additional complexity
to the userspace. Generally speaking, any process hanging in D-state
for a long time isn't the nicest object from the userspace's point of view.

Exactly as a SIGSTOPped process can be killed without sending SIGCONT,
why a frozen task would require some additional operations?

And I'm not talking about the case, when the process which is sending
SIGKILL has no write access to cgroupfs.


> Why I am starting to argue... The ability to kill a frozen task complicates
> the code, and since cgroup_enter_stopped() (in this version at least) doesn't
> properly interacts with freezable_schedule() leads to other problems.
> 
> From 7/7:
> 
> 	+  cgroup.freeze
> 	+	A read-write single value file which exists on non-root cgroups.
> 	+	Allowed values are "0" and "1". The default is "0".
> 	+
> 	+	Writing "1" to the file causes freezing of the cgroup and all
> 	+	descendant cgroups. This means that all belonging processes will
> 	+	be stopped and will not run until the cgroup will be explicitly
> 	+	unfrozen. Freezing of the cgroup may take some time;
>                                                  ^^^^^^^^^^^^^^^^^^
> it may take infinite time.
> 
> Just suppose that a task does vfork() and this races with cgroup_do_freeze(true).
> If the new child notices JOBCTL_TRAP_FREEZE before exit/exec the cgroup will be
> never frozen.

Hm, why? cgroup_update_frozen() called from cgroup_post_fork() should bring
the cgroup into the frozen state. If it's not true (I'm missing some race here),
it's a bug, but I don't see why it's not possible in general.

> 
> If I read the current kernel/cgroup/freezer.c correctly, CGROUP_FREEZING should
> "always" work (unless a task hangs in D state) and to me this looks more important
> than kill/ptrace support...

Again, I don't see a case, when cgroup v1 freezer will work and the proposed
v2 freezer won't work in general.

> 
> > there is no separate controller, which has to be enabled, etc.
> 
> agreed, this is nice.

Thanks!

  reply	other threads:[~2019-02-20 22:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 22:02 [PATCH v8 0/7] freezer for cgroup v2 Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 1/7] cgroup: rename freezer.c into legacy_freezer.c Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 2/7] cgroup: implement __cgroup_task_count() helper Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 3/7] cgroup: protect cgroup->nr_(dying_)descendants by css_set_lock Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 4/7] cgroup: cgroup v2 freezer Roman Gushchin
2019-02-20 14:42   ` Oleg Nesterov
2019-02-20 22:14     ` Roman Gushchin
2019-02-21 16:44       ` Oleg Nesterov
2019-02-19 22:02 ` [PATCH v8 5/7] kselftests: cgroup: don't fail on cg_kill_all() error in cg_destroy() Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 6/7] kselftests: cgroup: add freezer controller self-tests Roman Gushchin
2019-02-19 22:02 ` [PATCH v8 7/7] cgroup: document cgroup v2 freezer interface Roman Gushchin
2019-02-20 14:37 ` [PATCH v8 0/7] freezer for cgroup v2 Oleg Nesterov
2019-02-20 22:00   ` Roman Gushchin [this message]
2019-02-21 16:29     ` Oleg Nesterov
2019-02-21 17:34       ` Tejun Heo
2019-02-22 16:34         ` Oleg Nesterov
2019-02-22 18:17           ` Tejun Heo
2019-02-25 15:57             ` Oleg Nesterov
2019-03-05 17:27               ` Tejun Heo
2019-02-21 22:43       ` Roman Gushchin
2019-02-22 17:04         ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220220020.GA16335@castle.DHCP.thefacebook.com \
    --to=guro@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=cgroups@vger.kernel.org \
    --cc=guroan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).