mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
memcontrol: rcu_read_lock() to protect mm_match_cgroup()
mm_match_cgroup() calls cgroup_subsys_state(). We must use rcu_read_lock() to protect cgroup_subsys_state(). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Paul Menage <menage@google.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
18f59ea7de
commit
2e4d40915f
1 changed files with 9 additions and 2 deletions
|
@ -61,8 +61,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);
|
extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
|
||||||
|
|
||||||
#define mm_match_cgroup(mm, cgroup) \
|
static inline
|
||||||
((cgroup) == mem_cgroup_from_task((mm)->owner))
|
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
|
extern int
|
||||||
mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
|
mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue