lkml.org 
[lkml]   [2013]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/8] cgroup: implement cgroup_from_id()
On Wed 24-07-13 18:00:39, Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> There's a difference with cgroup id and css id. cgroup id starts with 0,
> while css id starts with 1.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>

Reviewed-by: Michal Hocko <mhocko@suse.cz>

Typo fix bellow
[...]
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index ee3c02e..9b27775 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -5536,6 +5536,22 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id)
> return css ? css : ERR_PTR(-ENOENT);
> }
>
> +/**
> + * cgroup_from_id - lookup cgroup by id
> + * @ss: cgroup subsys to be looked into
> + * @id: the cgroup id
> + *
> + * Returns the cgroup is there's valid one with @id, otherwise returns Null.

s/ is / if /

> + * Should be called under rcu_readlock().
> + */
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
> +{
> + rcu_lockdep_assert(rcu_read_lock_held(),
> + "cgroup_from_id() needs rcu_read_lock()"
> + " protection");
> + return idr_find(&ss->root->cgroup_idr, id);
> +}
> +
> #ifdef CONFIG_CGROUP_DEBUG
> static struct cgroup_subsys_state *debug_css_alloc(struct cgroup *cgrp)
> {
> --
> 1.8.0.2

--
Michal Hocko
SUSE Labs


\
 
 \ /
  Last update: 2013-07-24 17:21    [W:0.133 / U:1.360 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site