aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-07 16:58:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-07 16:58:21 -0400
commit91bc482ec5a615e8ecebc106aaf7d0c267d511de (patch)
treead75789a5825fb2da75b2dbdc02d1969bad9b338 /mm
parente8e8fade7b351f131433fa44ca5d4e960e1c0f9c (diff)
parentee84b8243b07c33a5c8aed42b4b2da60cb16d1d2 (diff)
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rcu: create rcu_my_thread_group_empty() wrapper memcg: css_id() must be called under rcu_read_lock() cgroup: Check task_lock in task_subsys_state() sched: Fix an RCU warning in print_task() cgroup: Fix an RCU warning in alloc_css_id() cgroup: Fix an RCU warning in cgroup_path() KEYS: Fix an RCU warning in the reading of user keys KEYS: Fix an RCU warning
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6c755de385f7..0f711c213d2e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -811,10 +811,12 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
811 * enabled in "curr" and "curr" is a child of "mem" in *cgroup* 811 * enabled in "curr" and "curr" is a child of "mem" in *cgroup*
812 * hierarchy(even if use_hierarchy is disabled in "mem"). 812 * hierarchy(even if use_hierarchy is disabled in "mem").
813 */ 813 */
814 rcu_read_lock();
814 if (mem->use_hierarchy) 815 if (mem->use_hierarchy)
815 ret = css_is_ancestor(&curr->css, &mem->css); 816 ret = css_is_ancestor(&curr->css, &mem->css);
816 else 817 else
817 ret = (curr == mem); 818 ret = (curr == mem);
819 rcu_read_unlock();
818 css_put(&curr->css); 820 css_put(&curr->css);
819 return ret; 821 return ret;
820} 822}
@@ -2312,7 +2314,9 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
2312 2314
2313 /* record memcg information */ 2315 /* record memcg information */
2314 if (do_swap_account && swapout && memcg) { 2316 if (do_swap_account && swapout && memcg) {
2317 rcu_read_lock();
2315 swap_cgroup_record(ent, css_id(&memcg->css)); 2318 swap_cgroup_record(ent, css_id(&memcg->css));
2319 rcu_read_unlock();
2316 mem_cgroup_get(memcg); 2320 mem_cgroup_get(memcg);
2317 } 2321 }
2318 if (swapout && memcg) 2322 if (swapout && memcg)
@@ -2369,8 +2373,10 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
2369{ 2373{
2370 unsigned short old_id, new_id; 2374 unsigned short old_id, new_id;
2371 2375
2376 rcu_read_lock();
2372 old_id = css_id(&from->css); 2377 old_id = css_id(&from->css);
2373 new_id = css_id(&to->css); 2378 new_id = css_id(&to->css);
2379 rcu_read_unlock();
2374 2380
2375 if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) { 2381 if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
2376 mem_cgroup_swap_statistics(from, false); 2382 mem_cgroup_swap_statistics(from, false);
@@ -4038,11 +4044,16 @@ static int is_target_pte_for_mc(struct vm_area_struct *vma,
4038 put_page(page); 4044 put_page(page);
4039 } 4045 }
4040 /* throught */ 4046 /* throught */
4041 if (ent.val && do_swap_account && !ret && 4047 if (ent.val && do_swap_account && !ret) {
4042 css_id(&mc.from->css) == lookup_swap_cgroup(ent)) { 4048 unsigned short id;
4043 ret = MC_TARGET_SWAP; 4049 rcu_read_lock();
4044 if (target) 4050 id = css_id(&mc.from->css);
4045 target->ent = ent; 4051 rcu_read_unlock();
4052 if (id == lookup_swap_cgroup(ent)) {
4053 ret = MC_TARGET_SWAP;
4054 if (target)
4055 target->ent = ent;
4056 }
4046 } 4057 }
4047 return ret; 4058 return ret;
4048} 4059}