diff options
Diffstat (limited to 'mm/memcontrol.c')
| -rw-r--r-- | mm/memcontrol.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0f711c213d2e..8a79a6f0f029 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -811,12 +811,10 @@ 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(); | ||
| 815 | if (mem->use_hierarchy) | 814 | if (mem->use_hierarchy) |
| 816 | ret = css_is_ancestor(&curr->css, &mem->css); | 815 | ret = css_is_ancestor(&curr->css, &mem->css); |
| 817 | else | 816 | else |
| 818 | ret = (curr == mem); | 817 | ret = (curr == mem); |
| 819 | rcu_read_unlock(); | ||
| 820 | css_put(&curr->css); | 818 | css_put(&curr->css); |
| 821 | return ret; | 819 | return ret; |
| 822 | } | 820 | } |
| @@ -1603,7 +1601,6 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
| 1603 | * There is a small race that "from" or "to" can be | 1601 | * There is a small race that "from" or "to" can be |
| 1604 | * freed by rmdir, so we use css_tryget(). | 1602 | * freed by rmdir, so we use css_tryget(). |
| 1605 | */ | 1603 | */ |
| 1606 | rcu_read_lock(); | ||
| 1607 | from = mc.from; | 1604 | from = mc.from; |
| 1608 | to = mc.to; | 1605 | to = mc.to; |
| 1609 | if (from && css_tryget(&from->css)) { | 1606 | if (from && css_tryget(&from->css)) { |
| @@ -1624,7 +1621,6 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
| 1624 | do_continue = (to == mem_over_limit); | 1621 | do_continue = (to == mem_over_limit); |
| 1625 | css_put(&to->css); | 1622 | css_put(&to->css); |
| 1626 | } | 1623 | } |
| 1627 | rcu_read_unlock(); | ||
| 1628 | if (do_continue) { | 1624 | if (do_continue) { |
| 1629 | DEFINE_WAIT(wait); | 1625 | DEFINE_WAIT(wait); |
| 1630 | prepare_to_wait(&mc.waitq, &wait, | 1626 | prepare_to_wait(&mc.waitq, &wait, |
| @@ -2314,9 +2310,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) | |||
| 2314 | 2310 | ||
| 2315 | /* record memcg information */ | 2311 | /* record memcg information */ |
| 2316 | if (do_swap_account && swapout && memcg) { | 2312 | if (do_swap_account && swapout && memcg) { |
| 2317 | rcu_read_lock(); | ||
| 2318 | swap_cgroup_record(ent, css_id(&memcg->css)); | 2313 | swap_cgroup_record(ent, css_id(&memcg->css)); |
| 2319 | rcu_read_unlock(); | ||
| 2320 | mem_cgroup_get(memcg); | 2314 | mem_cgroup_get(memcg); |
| 2321 | } | 2315 | } |
| 2322 | if (swapout && memcg) | 2316 | if (swapout && memcg) |
| @@ -2373,10 +2367,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry, | |||
| 2373 | { | 2367 | { |
| 2374 | unsigned short old_id, new_id; | 2368 | unsigned short old_id, new_id; |
| 2375 | 2369 | ||
| 2376 | rcu_read_lock(); | ||
| 2377 | old_id = css_id(&from->css); | 2370 | old_id = css_id(&from->css); |
| 2378 | new_id = css_id(&to->css); | 2371 | new_id = css_id(&to->css); |
| 2379 | rcu_read_unlock(); | ||
| 2380 | 2372 | ||
| 2381 | if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) { | 2373 | if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) { |
| 2382 | mem_cgroup_swap_statistics(from, false); | 2374 | mem_cgroup_swap_statistics(from, false); |
| @@ -4044,16 +4036,11 @@ static int is_target_pte_for_mc(struct vm_area_struct *vma, | |||
| 4044 | put_page(page); | 4036 | put_page(page); |
| 4045 | } | 4037 | } |
| 4046 | /* throught */ | 4038 | /* throught */ |
| 4047 | if (ent.val && do_swap_account && !ret) { | 4039 | if (ent.val && do_swap_account && !ret && |
| 4048 | unsigned short id; | 4040 | css_id(&mc.from->css) == lookup_swap_cgroup(ent)) { |
| 4049 | rcu_read_lock(); | 4041 | ret = MC_TARGET_SWAP; |
| 4050 | id = css_id(&mc.from->css); | 4042 | if (target) |
| 4051 | rcu_read_unlock(); | 4043 | target->ent = ent; |
| 4052 | if (id == lookup_swap_cgroup(ent)) { | ||
| 4053 | ret = MC_TARGET_SWAP; | ||
| 4054 | if (target) | ||
| 4055 | target->ent = ent; | ||
| 4056 | } | ||
| 4057 | } | 4044 | } |
| 4058 | return ret; | 4045 | return ret; |
| 4059 | } | 4046 | } |
