lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090702090447.GD4305@localdomain>
Date:	Thu, 2 Jul 2009 11:04:48 +0200
From:	Louis Rilling <Louis.Rilling@...labs.com>
To:	Paul Menage <menage@...gle.com>
Cc:	lizf@...fujitsu.com, balbir@...ux.vnet.ibm.com,
	containers@...ts.linux-foundation.org, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/9] [RFC] Remove cgroup_subsys.root pointer

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

Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ