[Devel] Re: [PATCH 2/4] cgroups: subsystem module loading interface

Li Zefan lizf at cn.fujitsu.com
Sun Dec 27 22:32:20 PST 2009


> Add interface between cgroups subsystem management and module loading
> 
> From: Ben Blum <bblum at andrew.cmu.edu>
> 
> This patch implements rudimentary module-loading support for cgroups - namely,
> a cgroup_load_subsys (similar to cgroup_init_subsys) for use as a module
> initcall, and a struct module pointer in struct cgroup_subsys.
> 
> Several functions that might be wanted by modules have had EXPORT_SYMBOL added
> to them, but it's unclear exactly which functions want it and which won't.
> 
> Signed-off-by: Ben Blum <bblum at andrew.cmu.edu>

Acked-by: Li Zefan <lizf at cn.fujitsu.com>

Some small nitpicks:

> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -2477,6 +2477,7 @@ int cgroup_add_file(struct cgroup *cgrp,
>  		error = PTR_ERR(dentry);
>  	return error;
>  }
> +EXPORT_SYMBOL_GPL(cgroup_add_file);

I got compile errors, because you forgot to include <linux/module.h>

...
> +	write_lock(&css_set_lock);
> +	for (i = 0; i < CSS_SET_TABLE_SIZE; i++) {
> +		struct css_set *cg;
> +		struct hlist_node *node, *tmp;
> +		struct hlist_head *bucket = &css_set_table[i], *new_bucket;

Please add a blank line between variable declaration and other code.

And elsewhere in this patchset.

> +		hlist_for_each_entry_safe(cg, node, tmp, bucket, hlist) {
> +			/* skip entries that we already rehashed */
> +			if (cg->subsys[ss->subsys_id])
> +				continue;
> +			/* remove existing entry */
> +			hlist_del(&cg->hlist);
> +			/* set new value */
> +			cg->subsys[ss->subsys_id] = css;
> +			/* recompute hash and restore entry */
> +			new_bucket = css_set_hash(cg->subsys);
> +			hlist_add_head(&cg->hlist, new_bucket);
> +		}
> +	}
> +	write_unlock(&css_set_lock);


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list