From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: [PATCHSET cgroup/for-3.8] cgroup_freezer: implement proper hierarchy support Date: Sat, 3 Nov 2012 01:38:26 -0700 Message-ID: <1351931915-1701-1-git-send-email-tj@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=FIO12yTAoQpf+Q6xVJNoWaWC9NW5Jsh5jA9KD+qACc0=; b=bFjML/DBKW1cJAKvtsbSAhRwfnt4BED3d3T4DZhFcq7IVVm2IZB3yl2MIb21GOMH4y 1MYdsH3dldhZXlBJq68rEICmNMduyAymxfvdEI/eRTiPjr0ib1kjnyWp+Iineh2aIYlP XSE4Cm/h9yC+PQcvQn8e/8gXfLE+FiyhB/DW4XBXBEQZfunWeg4pbSUOdlRPJlHmIAqc vPsvfrQo1+K6bToUqpGf08q8Nkpg8mjo2EpE8tuj5ruSeAbf/LB+jqqLeZeb0RSk22HW hxQ5RUgqH6PcLvdVMP2O507ifZc/SoaryYrBAwTGGHuA2Z1n/qJ8PBF/v2FFRfEDd3Hw Dfbw== List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, mhocko-AlSwsSmVLrQ@public.gmane.org, rjw-KKrjLPT3xs0@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hello, This patchset implement proper hierarchy support for cgroup_freezer as discussed in "[RFC] cgroup TODOs"[1]. The patchset first implements generic cgroup iteration macros - cgroup_for_each_children(), cgroup_for_each_descendant_{pre|post}(). Combined with the newly introduced ->post_create() callback, this allows controllers to implement reliable iteration over descendants without messing with cgroup internal locking. Controllers can perform reliable walking using simple hierarchy-wide locking or finer-grained parent-children locking. Using the iteration macros and ->post_create(), cgroup_freezer is updated to propagate state updates to and collect FROZEN completions from the descendants. This removes .broken_hierarchy marking from cgroup_freezer. cgroup_freezer hierarchy support is implemented using finer-grained locking not necessarily because it's necessary but more because I wanted an example controller doing that. This patchset contains the following nine patches. 0001-cgroup-add-cgroup_subsys-post_create.patch 0002-cgroup-Use-rculist-ops-for-cgroup-children.patch 0003-cgroup-implement-generic-child-descendant-walk-macro.patch 0004-cgroup_freezer-trivial-cleanups.patch 0005-cgroup_freezer-prepare-freezer_change_state-for-full.patch 0006-cgroup_freezer-make-freezer-state-mask-of-flags.patch 0007-cgroup_freezer-introduce-CGROUP_FREEZING_-SELF-PAREN.patch 0008-cgroup_freezer-add-post_create-and-pre_destroy-and-t.patch 0009-cgroup_freezer-implement-proper-hierarchy-support.patch 0001-0003 implement cgroup descendant iterators. 0004-0008 prepare cgroup_freezer for hierarchy support. 0009 implements it. This patchset is on top of v3.6 (a0d271cbfe) + [2] the first three patches of "memcg/cgroup: do not fail fail on pre_destroy callbacks" patchset + [3] "cgroup: simplify cgroup removal path" v2 patchset with cgroup/for-3.8 pulled into it. The branch is rather floaty at the moment so it would be the easiest to pull the following branch for review. git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cgroup_freezer-hierarchy Thanks. kernel/cgroup.c | 106 +++++++++++++- kernel/cgroup_freezer.c | 359 +++++++++++++++++++++++++++++++++++------------- 3 files changed, 445 insertions(+), 104 deletions(-) -- tejun [1] http://thread.gmane.org/gmane.linux.kernel.containers/23698 [2] http://thread.gmane.org/gmane.linux.kernel.cgroups/4757 [3] http://thread.gmane.org/gmane.linux.kernel.cgroups/4861 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754361Ab2KCIi7 (ORCPT ); Sat, 3 Nov 2012 04:38:59 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:36901 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753873Ab2KCIix (ORCPT ); Sat, 3 Nov 2012 04:38:53 -0400 From: Tejun Heo To: lizefan@huawei.com, mhocko@suse.cz, rjw@sisk.pl Cc: containers@lists.linux-foundation.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, fweisbec@gmail.com Subject: [PATCHSET cgroup/for-3.8] cgroup_freezer: implement proper hierarchy support Date: Sat, 3 Nov 2012 01:38:26 -0700 Message-Id: <1351931915-1701-1-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.7.11.7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This patchset implement proper hierarchy support for cgroup_freezer as discussed in "[RFC] cgroup TODOs"[1]. The patchset first implements generic cgroup iteration macros - cgroup_for_each_children(), cgroup_for_each_descendant_{pre|post}(). Combined with the newly introduced ->post_create() callback, this allows controllers to implement reliable iteration over descendants without messing with cgroup internal locking. Controllers can perform reliable walking using simple hierarchy-wide locking or finer-grained parent-children locking. Using the iteration macros and ->post_create(), cgroup_freezer is updated to propagate state updates to and collect FROZEN completions from the descendants. This removes .broken_hierarchy marking from cgroup_freezer. cgroup_freezer hierarchy support is implemented using finer-grained locking not necessarily because it's necessary but more because I wanted an example controller doing that. This patchset contains the following nine patches. 0001-cgroup-add-cgroup_subsys-post_create.patch 0002-cgroup-Use-rculist-ops-for-cgroup-children.patch 0003-cgroup-implement-generic-child-descendant-walk-macro.patch 0004-cgroup_freezer-trivial-cleanups.patch 0005-cgroup_freezer-prepare-freezer_change_state-for-full.patch 0006-cgroup_freezer-make-freezer-state-mask-of-flags.patch 0007-cgroup_freezer-introduce-CGROUP_FREEZING_-SELF-PAREN.patch 0008-cgroup_freezer-add-post_create-and-pre_destroy-and-t.patch 0009-cgroup_freezer-implement-proper-hierarchy-support.patch 0001-0003 implement cgroup descendant iterators. 0004-0008 prepare cgroup_freezer for hierarchy support. 0009 implements it. This patchset is on top of v3.6 (a0d271cbfe) + [2] the first three patches of "memcg/cgroup: do not fail fail on pre_destroy callbacks" patchset + [3] "cgroup: simplify cgroup removal path" v2 patchset with cgroup/for-3.8 pulled into it. The branch is rather floaty at the moment so it would be the easiest to pull the following branch for review. git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cgroup_freezer-hierarchy Thanks. kernel/cgroup.c | 106 +++++++++++++- kernel/cgroup_freezer.c | 359 +++++++++++++++++++++++++++++++++++------------- 3 files changed, 445 insertions(+), 104 deletions(-) -- tejun [1] http://thread.gmane.org/gmane.linux.kernel.containers/23698 [2] http://thread.gmane.org/gmane.linux.kernel.cgroups/4757 [3] http://thread.gmane.org/gmane.linux.kernel.cgroups/4861