From: Frederic Weisbecker <fweisbec@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: rjw@sisk.pl, paul@paulmenage.org, lizf@cn.fujitsu.com,
linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, matthltc@us.ibm.com,
kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH 6/6] cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task()
Date: Tue, 30 Aug 2011 22:10:32 +0200 [thread overview]
Message-ID: <20110830201030.GC15953@somewhere.redhat.com> (raw)
In-Reply-To: <1314312192-26885-7-git-send-email-tj@kernel.org>
On Fri, Aug 26, 2011 at 12:43:12AM +0200, Tejun Heo wrote:
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index f3c7f7a..ce765ec 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -2075,7 +2064,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> {
> int retval, i, group_size, nr_migrating_tasks;
> struct cgroup_subsys *ss, *failed_ss = NULL;
> - bool cancel_failed_ss = false;
> /* guaranteed to be initialized later, but the compiler needs this */
> struct css_set *oldcg;
> struct cgroupfs_root *root = cgrp->root;
> @@ -2166,21 +2154,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> goto out_cancel_attach;
> }
> }
> - /* a callback to be run on every thread in the threadgroup. */
> - if (ss->can_attach_task) {
> - /* run on each task in the threadgroup. */
> - for (i = 0; i < group_size; i++) {
> - tc = flex_array_get(group, i);
> - if (tc->cgrp == cgrp)
> - continue;
> - retval = ss->can_attach_task(cgrp, tc->task);
> - if (retval) {
> - failed_ss = ss;
> - cancel_failed_ss = true;
> - goto out_cancel_attach;
> - }
> - }
> - }
> }
>
> /*
> @@ -2217,15 +2190,10 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> }
>
> /*
> - * step 3: now that we're guaranteed success wrt the css_sets, proceed
> - * to move all tasks to the new cgroup, calling ss->attach_task for each
> - * one along the way. there are no failure cases after here, so this is
> - * the commit point.
> + * step 3: now that we're guaranteed success wrt the css_sets,
> + * proceed to move all tasks to the new cgroup. There are no
> + * failure cases after here, so this is the commit point.
> */
> - for_each_subsys(root, ss) {
> - if (ss->pre_attach)
> - ss->pre_attach(cgrp);
> - }
> for (i = 0; i < group_size; i++) {
> tc = flex_array_get(group, i);
> /* leave current thread as it is if it's already there */
> @@ -2235,19 +2203,11 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> /* if the thread is PF_EXITING, it can just get skipped. */
> retval = cgroup_task_migrate(cgrp, tc->cgrp, tc->task, true);
> BUG_ON(retval != 0 && retval != -ESRCH);
> -
> - /* attach each task to each subsystem */
> - for_each_subsys(root, ss) {
> - if (ss->attach_task)
> - ss->attach_task(cgrp, tc->task);
> - }
In order to keep the fix queued in -mm (https://lkml.org/lkml/2011/8/26/262)
the tasks that have failed to migrate should be removed from the iterator
so that they are not included in the batch in ->attach().
> }
> /* nothing is sensitive to fork() after this point. */
>
> /*
> - * step 4: do expensive, non-thread-specific subsystem callbacks.
> - * TODO: if ever a subsystem needs to know the oldcgrp for each task
> - * being moved, this call will need to be reworked to communicate that.
> + * step 4: do subsystem attach callbacks.
> */
> for_each_subsys(root, ss) {
> if (ss->attach)
> @@ -2271,11 +2231,8 @@ out_cancel_attach:
> /* same deal as in cgroup_attach_task */
> if (retval) {
> for_each_subsys(root, ss) {
> - if (ss == failed_ss) {
> - if (cancel_failed_ss && ss->cancel_attach)
> - ss->cancel_attach(ss, cgrp, &tset);
> + if (ss == failed_ss)
> break;
> - }
> if (ss->cancel_attach)
> ss->cancel_attach(ss, cgrp, &tset);
> }
> --
> 1.7.6
>
next prev parent reply other threads:[~2011-08-30 20:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 22:43 [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods, take#2 Tejun Heo
2011-08-25 22:43 ` [PATCH 1/6] cgroup: subsys->attach_task() should be called after migration Tejun Heo
2011-08-26 4:12 ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 2/6] cgroup: improve old cgroup handling in cgroup_attach_proc() Tejun Heo
2011-08-26 4:13 ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 3/6] cgroup: introduce cgroup_taskset and use it in subsys->can_attach(), cancel_attach() and attach() Tejun Heo
2011-08-26 2:38 ` Matt Helsley
2011-08-26 2:48 ` Matt Helsley
2011-08-26 6:40 ` Tejun Heo
2011-08-26 15:54 ` Paul Menage
2011-08-26 4:16 ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 4/6] cgroup: don't use subsys->can_attach_task() or ->attach_task() Tejun Heo
2011-08-26 4:18 ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 5/6] cgroup, cpuset: don't use ss->pre_attach() Tejun Heo
2011-08-26 4:19 ` KAMEZAWA Hiroyuki
2011-08-25 22:43 ` [PATCH 6/6] cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task() Tejun Heo
2011-08-26 4:20 ` KAMEZAWA Hiroyuki
2011-08-30 20:10 ` Frederic Weisbecker [this message]
2011-08-31 7:03 ` Tejun Heo
2011-08-31 13:42 ` Frederic Weisbecker
2011-09-01 11:22 ` Tejun Heo
2011-09-01 12:58 ` Frederic Weisbecker
2011-08-25 22:48 ` [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods, take#2 Tejun Heo
2011-08-26 8:05 ` Li Zefan
2011-08-26 14:09 ` Tejun Heo
2011-08-26 14:56 ` Paul Menage
-- strict thread matches above, loose matches on Subject: below --
2011-08-23 22:19 [PATCHSET] cgroup: introduce cgroup_taskset and consolidate subsys methods Tejun Heo
2011-08-23 22:20 ` [PATCH 6/6] cgroup: kill subsys->can_attach_task(), pre_attach() and attach_task() Tejun Heo
2011-08-25 9:45 ` Paul Menage
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=20110830201030.GC15953@somewhere.redhat.com \
--to=fweisbec@gmail.com \
--cc=containers@lists.linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=lizf@cn.fujitsu.com \
--cc=matthltc@us.ibm.com \
--cc=paul@paulmenage.org \
--cc=rjw@sisk.pl \
--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