linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: lizefan@huawei.com
Cc: containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 10/12] cgroup: update subsystem rebind restrictions
Date: Mon, 14 Apr 2014 17:37:08 -0400	[thread overview]
Message-ID: <1397511430-2673-11-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1397511430-2673-1-git-send-email-tj@kernel.org>

Because the default root couldn't have any non-root csses attached to
it, rebinding away from it was always allowed; however, the default
hierarchy will soon host the unified hierarchy and have non-root csses
so the rebind restrictions need to be updated accordingly.

Instead of special casing rebinding from the default hierarchy and
then checking whether the source hierarchy has children cgroups, which
implies non-root csses for !dfl hierarchies, simply check whether the
source hierarchy has non-root csses for the subsystem using
css_next_child().

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/cgroup.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b4cd1fe..888e037 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1051,16 +1051,12 @@ static int rebind_subsystems(struct cgroup_root *dst_root,
 		if (!(ss_mask & (1 << ssid)))
 			continue;
 
-		/* if @ss is on the dummy_root, we can always move it */
-		if (ss->root == &cgrp_dfl_root)
-			continue;
-
-		/* if @ss has non-root cgroups attached to it, can't move */
-		if (!list_empty(&ss->root->cgrp.children))
+		/* if @ss has non-root csses attached to it, can't move */
+		if (css_next_child(NULL, cgroup_css(&ss->root->cgrp, ss)))
 			return -EBUSY;
 
 		/* can't move between two non-dummy roots either */
-		if (dst_root != &cgrp_dfl_root)
+		if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)
 			return -EBUSY;
 	}
 
-- 
1.9.0


  parent reply	other threads:[~2014-04-14 21:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 21:36 [PATCHSET cgroup/for-3.16] cgroup: implement unified hierarchy, v2 Tejun Heo
2014-04-14 21:36 ` [PATCH 01/12] cgroup: update cgroup->subsys_mask to ->child_subsys_mask and restore cgroup_root->subsys_mask Tejun Heo
2014-04-14 21:37 ` [PATCH 02/12] cgroup: introduce effective cgroup_subsys_state Tejun Heo
2014-04-14 21:37 ` [PATCH 03/12] cgroup: implement cgroup->e_csets[] Tejun Heo
2014-04-14 21:37 ` [PATCH 04/12] cgroup: make css_next_child() skip missing csses Tejun Heo
2014-04-14 21:37 ` [PATCH 05/12] cgroup: reorganize css_task_iter Tejun Heo
2014-04-14 21:37 ` [PATCH 06/12] cgroup: teach css_task_iter about effective csses Tejun Heo
2014-04-14 21:37 ` [PATCH 07/12] cgroup: cgroup->subsys[] should be cleared after the css is offlined Tejun Heo
2014-04-14 21:37 ` [PATCH 08/12] cgroup: allow cgroup creation and suppress automatic css creation in the unified hierarchy Tejun Heo
2014-04-14 21:37 ` [PATCH 09/12] cgroup: add css_set->dfl_cgrp Tejun Heo
2014-04-14 21:37 ` Tejun Heo [this message]
2014-04-14 21:37 ` [PATCH 11/12] cgroup: prepare migration path for unified hierarchy Tejun Heo
2014-04-14 21:37 ` [PATCH 12/12] cgroup: implement dynamic subtree controller enable/disable on the default hierarchy Tejun Heo
2014-04-17 18:03   ` Raghavendra KT
2014-04-18 20:41     ` Tejun Heo
2014-04-21  8:17       ` Raghavendra K T
2014-04-14 21:45 ` [PATCHSET cgroup/for-3.16] cgroup: implement unified hierarchy, v2 Tejun Heo
2014-04-15  2:23 ` Li Zefan
2014-04-15 22:08   ` Tejun Heo
2014-04-15 22:06 ` [PATCH 0.5/12] cgroup: cgroup_apply_cftypes() shouldn't skip the default hierarhcy Tejun Heo
2014-04-16  2:35 ` [PATCHSET cgroup/for-3.16] cgroup: implement unified hierarchy, v2 Li Zefan
2014-04-23 15:14 ` Tejun Heo
2014-04-30 10:52 ` Raghavendra KT
  -- strict thread matches above, loose matches on Subject: below --
2014-03-28  2:40 [PATCHSET cgroup/for-3.15] cgroup: implement unified hierarchy Tejun Heo
2014-03-28  2:40 ` [PATCH 10/12] cgroup: update subsystem rebind restrictions Tejun Heo

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=1397511430-2673-11-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    /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).