[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20081121193210.d7760fd6.kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 21 Nov 2008 19:32:10 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Paul Menage <menage@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Containers <containers@...ts.linux-foundation.org>
Subject: Re: [PATCH] memcontrol: rcu_read_lock() to protect
mm_match_cgroup()
On Fri, 21 Nov 2008 16:49:43 +0800
Lai Jiangshan <laijs@...fujitsu.com> wrote:
>
> mm_match_cgroup() calls cgroup_subsys_state().
>
> we must use rcu_read_lock() to protect cgroup_subsys_state().
>
Thanks,
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 1fbe14d..ce89ff0 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -47,8 +47,15 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
>
> extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
>
> -#define mm_match_cgroup(mm, cgroup) \
> - ((cgroup) == mem_cgroup_from_task((mm)->owner))
> +static inline
> +int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
> +{
> + struct mem_cgroup *mem;
> + rcu_read_lock();
> + mem = mem_cgroup_from_task((mm)->owner);
> + rcu_read_unlock();
> + return cgroup == mem;
> +}
>
> extern int
> mem_cgroup_prepare_migration(struct page *page, struct page *newpage);
>
>
--
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