aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0f711c213d2e..595d03f33b2c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2314,9 +2314,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
2314 2314
2315 /* record memcg information */ 2315 /* record memcg information */
2316 if (do_swap_account && swapout && memcg) { 2316 if (do_swap_account && swapout && memcg) {
2317 rcu_read_lock();
2318 swap_cgroup_record(ent, css_id(&memcg->css)); 2317 swap_cgroup_record(ent, css_id(&memcg->css));
2319 rcu_read_unlock();
2320 mem_cgroup_get(memcg); 2318 mem_cgroup_get(memcg);
2321 } 2319 }
2322 if (swapout && memcg) 2320 if (swapout && memcg)
@@ -2373,10 +2371,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
2373{ 2371{
2374 unsigned short old_id, new_id; 2372 unsigned short old_id, new_id;
2375 2373
2376 rcu_read_lock();
2377 old_id = css_id(&from->css); 2374 old_id = css_id(&from->css);
2378 new_id = css_id(&to->css); 2375 new_id = css_id(&to->css);
2379 rcu_read_unlock();
2380 2376
2381 if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) { 2377 if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
2382 mem_cgroup_swap_statistics(from, false); 2378 mem_cgroup_swap_statistics(from, false);
@@ -4044,16 +4040,11 @@ static int is_target_pte_for_mc(struct vm_area_struct *vma,
4044 put_page(page); 4040 put_page(page);
4045 } 4041 }
4046 /* throught */ 4042 /* throught */
4047 if (ent.val && do_swap_account && !ret) { 4043 if (ent.val && do_swap_account && !ret &&
4048 unsigned short id; 4044 css_id(&mc.from->css) == lookup_swap_cgroup(ent)) {
4049 rcu_read_lock(); 4045 ret = MC_TARGET_SWAP;
4050 id = css_id(&mc.from->css); 4046 if (target)
4051 rcu_read_unlock(); 4047 target->ent = ent;
4052 if (id == lookup_swap_cgroup(ent)) {
4053 ret = MC_TARGET_SWAP;
4054 if (target)
4055 target->ent = ent;
4056 }
4057 } 4048 }
4058 return ret; 4049 return ret;
4059} 4050}