diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f4ede99c8b9b..8a79a6f0f029 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1601,7 +1601,6 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
1601 | * There is a small race that "from" or "to" can be | 1601 | * There is a small race that "from" or "to" can be |
1602 | * freed by rmdir, so we use css_tryget(). | 1602 | * freed by rmdir, so we use css_tryget(). |
1603 | */ | 1603 | */ |
1604 | rcu_read_lock(); | ||
1605 | from = mc.from; | 1604 | from = mc.from; |
1606 | to = mc.to; | 1605 | to = mc.to; |
1607 | if (from && css_tryget(&from->css)) { | 1606 | if (from && css_tryget(&from->css)) { |
@@ -1622,7 +1621,6 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
1622 | do_continue = (to == mem_over_limit); | 1621 | do_continue = (to == mem_over_limit); |
1623 | css_put(&to->css); | 1622 | css_put(&to->css); |
1624 | } | 1623 | } |
1625 | rcu_read_unlock(); | ||
1626 | if (do_continue) { | 1624 | if (do_continue) { |
1627 | DEFINE_WAIT(wait); | 1625 | DEFINE_WAIT(wait); |
1628 | prepare_to_wait(&mc.waitq, &wait, | 1626 | prepare_to_wait(&mc.waitq, &wait, |
@@ -2429,11 +2427,11 @@ int mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) | |||
2429 | } | 2427 | } |
2430 | unlock_page_cgroup(pc); | 2428 | unlock_page_cgroup(pc); |
2431 | 2429 | ||
2430 | *ptr = mem; | ||
2432 | if (mem) { | 2431 | if (mem) { |
2433 | ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false); | 2432 | ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, ptr, false); |
2434 | css_put(&mem->css); | 2433 | css_put(&mem->css); |
2435 | } | 2434 | } |
2436 | *ptr = mem; | ||
2437 | return ret; | 2435 | return ret; |
2438 | } | 2436 | } |
2439 | 2437 | ||