]> git.baikalelectronics.ru Git - kernel.git/commit
memcg: take reference before releasing rcu_read_lock
authorLi Zefan <lizefan@huawei.com>
Mon, 29 Apr 2013 22:08:57 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Apr 2013 22:54:40 +0000 (15:54 -0700)
commit30ffbd40a90fc9976e9fb63baf8569ac815030b3
treeb16a3376d70d0da276ee77a86a0c57c4acd7d457
parent43f905a15c2ee12202b959c99b6b14f6be6216a7
memcg: take reference before releasing rcu_read_lock

The memcg is not referenced, so it can be destroyed at anytime right
after we exit rcu read section, so it's not safe to access it.

To fix this, we call css_tryget() to get a reference while we're still
in rcu read section.

This also removes a bogus comment above __memcg_create_cache_enqueue().

Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: Glauber Costa <glommer@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c