From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: Paul Menage <menage@google.com>
Cc: lizf@cn.fujitsu.com, balbir@linux.vnet.ibm.com,
containers@lists.linux-foundation.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] [RFC] Remove cgroup_subsys.root pointer
Date: Thu, 2 Jul 2009 11:04:48 +0200 [thread overview]
Message-ID: <20090702090447.GD4305@localdomain> (raw)
In-Reply-To: <20090702021118.14469.2107.stgit@menage.mtv.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2444 bytes --]
On Wed, Jul 01, 2009 at 07:11:18PM -0700, Paul Menage wrote:
> [RFC] Remove cgroup_subsys.root pointer
>
> In preparation for supporting cgroup subsystems that can be bound to
> multiple hierarchies, remove the "root" pointer and associated list
> structures. Subsystem hierarchy membership is now determined entirely
> through the subsystem bitmasks in struct cgroupfs_root.
>
> Minor changes include:
> - root_list now includes the inactive root
> - for_each_active_root() -> for_each_root()
> - for_each_subsys() is now guaranteed to be in subsys_id order
>
[...]
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index dede632..8b1b92f 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
[...]
> @@ -191,13 +182,36 @@ static int notify_on_release(const struct cgroup *cgrp)
> * for_each_subsys() allows you to iterate on each subsystem attached to
> * an active hierarchy
> */
> +static inline struct cgroup_subsys *nth_ss(int n)
> +{
> + return (n >= CGROUP_SUBSYS_COUNT) ? NULL : subsys[n];
> +}
> #define for_each_subsys(_root, _ss) \
> -list_for_each_entry(_ss, &_root->subsys_list, sibling)
> +for (_ss = nth_ss(find_first_bit(&(_root)->subsys_bits, CGROUP_SUBSYS_COUNT));\
> + _ss != NULL; \
> + _ss = nth_ss(find_next_bit(&(_root)->subsys_bits, CGROUP_SUBSYS_COUNT, \
> + _ss->subsys_id + 1)))
>
> -/* for_each_active_root() allows you to iterate across the active hierarchies */
> -#define for_each_active_root(_root) \
> +
> +/* for_each_root() allows you to iterate across all hierarchies */
> +#define for_each_root(_root) \
> list_for_each_entry(_root, &roots, root_list)
>
> +/* Find the root for a given subsystem */
> +static struct cgroupfs_root *find_root(struct cgroup_subsys *ss)
> +{
> + int id = ss->subsys_id;
> + struct cgroupfs_root *root, *res = NULL;
> + for_each_root(root) {
> + if (root->subsys_bits && (1UL << id)) {
Should be &, not && ------------------^^
Louis
> + BUG_ON(res);
> + res = root;
> + }
> + }
> + BUG_ON(!res);
> + return res;
> +}
> +
> /* the list of cgroups eligible for automatic release. Protected by
> * release_list_lock */
> static LIST_HEAD(release_list);
[...]
--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-07-02 9:04 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 2:10 [PATCH 0/9] [RFC] CGroup Hierarchy Extensions Paul Menage
2009-07-02 2:10 ` [PATCH 1/9] [RFC] Support named cgroups hierarchies Paul Menage
2009-07-02 2:28 ` KAMEZAWA Hiroyuki
2009-07-02 2:49 ` Paul Menage
2009-07-03 1:51 ` Li Zefan
2009-07-02 8:09 ` Louis Rilling
2009-07-02 8:19 ` Paul Menage
2009-07-02 8:24 ` Louis Rilling
2009-07-03 2:32 ` Li Zefan
2009-07-13 23:39 ` Paul Menage
2009-07-02 2:11 ` [PATCH 2/9] [RFC]Move the cgroup debug subsys into cgroup.c to access internal state Paul Menage
2009-07-02 2:11 ` [PATCH 3/9] [RFC] Add a back-pointer from struct cg_cgroup_link to struct cgroup Paul Menage
2009-07-03 7:07 ` Li Zefan
2009-07-21 23:48 ` Paul Menage
2009-07-02 2:11 ` [PATCH 4/9] [RFC] Allow cgroup hierarchies to be created with no bound subsystems Paul Menage
2009-07-03 7:57 ` Li Zefan
2009-07-21 23:31 ` Paul Menage
2009-07-02 2:11 ` [PATCH 5/9] [RFC] Remove cgroup_subsys.root pointer Paul Menage
2009-07-02 9:04 ` Louis Rilling [this message]
2009-07-02 9:32 ` Paul Menage
2009-07-02 2:11 ` [PATCH 6/9] [RFC] Remove the cgroup_subsys.bind callback Paul Menage
2009-07-02 2:11 ` [PATCH 7/9] [RFC] Support multiply-bindable cgroup subsystems Paul Menage
2009-07-02 2:45 ` KAMEZAWA Hiroyuki
2009-07-02 2:52 ` Paul Menage
2009-07-02 3:16 ` KAMEZAWA Hiroyuki
2009-07-02 5:04 ` Paul Menage
2009-07-03 8:36 ` Li Zefan
2009-07-02 2:11 ` [PATCH 8/9] [RFC] Example multi-bindable subsystem: a per-cgroup notes field Paul Menage
2009-07-02 2:48 ` KAMEZAWA Hiroyuki
2009-07-02 2:56 ` Paul Menage
2009-07-02 3:17 ` KAMEZAWA Hiroyuki
2009-07-02 7:22 ` Paul Menage
2009-07-03 8:58 ` Li Zefan
2009-07-14 0:49 ` Paul Menage
2009-07-02 2:11 ` [PATCH 9/9] [RFC] Example multi-bindable subsystem: a max-depth controller 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=20090702090447.GD4305@localdomain \
--to=louis.rilling@kerlabs.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.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