The patch titled memcontrol: rcu_read_lock() to protect mm_match_cgroup() has been added to the -mm tree. Its filename is memcontrol-rcu_read_lock-to-protect-mm_match_cgroup.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: memcontrol: rcu_read_lock() to protect mm_match_cgroup() From: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> mm_match_cgroup() calls cgroup_subsys_state(). We must use rcu_read_lock() to protect cgroup_subsys_state(). Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memcontrol.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff -puN include/linux/memcontrol.h~memcontrol-rcu_read_lock-to-protect-mm_match_cgroup include/linux/memcontrol.h --- a/include/linux/memcontrol.h~memcontrol-rcu_read_lock-to-protect-mm_match_cgroup +++ a/include/linux/memcontrol.h @@ -61,8 +61,15 @@ int task_in_mem_cgroup(struct task_struc 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 mem_cgroup **ptr); _ Patches currently in -mm which might be from laijs@xxxxxxxxxxxxxx are origin.patch linux-next.patch kprobes-bugfix-try_module_get-even-if-calling_mod-is-null.patch cgroups-add-lock-for-child-cgroups-in-cgroup_post_fork.patch cgroups-fix-cgroup_iter_next-bug.patch cgroups-dont-put-struct-cgroupfs_root-protected-by-rcu.patch cgroups-use-task_lock-for-access-tsk-cgroups-safe-in-cgroup_clone.patch cgroups-call-find_css_set-safely-in-cgroup_attach_task.patch devcgroup-use-list_for_each_entry_rcu.patch memcontrol-rcu_read_lock-to-protect-mm_match_cgroup.patch cpuset-rcu_read_lock-to-protect-task_cs.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html