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: <52E880A6.4040902@huawei.com>
Date:	Wed, 29 Jan 2014 12:16:38 +0800
From:	Li Zefan <lizefan@...wei.com>
To:	Tejun Heo <tj@...nel.org>
CC:	<containers@...ts.linux-foundation.org>, <cgroups@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/6] cgroup: drop module support

>  /**
> - * for_each_subsys - iterate all loaded cgroup subsystems
> + * for_each_subsys - iterate all enabled cgroup subsystems
>   * @ss: the iteration cursor
>   * @ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end
> - *
> - * Iterates through all loaded subsystems.  Should be called under
> - * cgroup_mutex or cgroup_root_mutex.
>   */
>  #define for_each_subsys(ss, ssid)					\
> -	for (({ cgroup_assert_mutex_or_root_locked(); (ssid) = 0; });	\
> -	     (ssid) < CGROUP_SUBSYS_COUNT; (ssid)++)			\
> -		if (!((ss) = cgroup_subsys[(ssid)])) { }		\
> -		else
> -
> -/**
> - * for_each_builtin_subsys - iterate all built-in cgroup subsystems
> - * @ss: the iteration cursor
> - * @i: the index of @ss, CGROUP_BUILTIN_SUBSYS_COUNT after reaching the end
> - *
> - * Bulit-in subsystems are always present and iteration itself doesn't
> - * require any synchronization.
> - */
> -#define for_each_builtin_subsys(ss, i)					\
> -	for ((i) = 0; (i) < CGROUP_BUILTIN_SUBSYS_COUNT &&		\
> -	     (((ss) = cgroup_subsys[i]) || true); (i)++)
> +	for ((ssid) = 0; (ssid) < CGROUP_SUBSYS_COUNT &&		\
> +	     (((ss) = cgroup_subsys[ssid]) || true); (ssid)++)

Now cgroup_subsys[i] won't be NULL, so we can drop "|| true".

>  
>  /* iterate across the active hierarchies */
>  #define for_each_active_root(root)					\
> @@ -975,50 +951,24 @@ static void cgroup_d_remove_dir(struct dentry *dentry)
>  	remove_dir(dentry);
>  }
>  

...

> -	if (need_forkexit_callback) {
> -		/*
> -		 * fork/exit callbacks are supported only for builtin
> -		 * subsystems, and the builtin section of the subsys
> -		 * array is immutable, so we don't need to lock the
> -		 * subsys array here. On the other hand, modular section
> -		 * of the array can be freed at module unload, so we
> -		 * can't touch that.
> -		 */
> -		for_each_builtin_subsys(ss, i)
> +	if (need_forkexit_callback)
> +		for_each_subsys(ss, i)
>  			if (ss->fork)
>  				ss->fork(child);
> -	}

This looks a bit ugly. How about leaving the parentheses for the
outmost if statement?

if (need_forkexit_callback) {
	for_each_subsys(ss, i)
		if (ss->fork)
			ss->fork(child);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ