diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2014-12-10 18:44:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:07 -0500 |
commit | 4e2f245d38ba86e3922c6c188fe4a0d0688aed88 (patch) | |
tree | 8d4f91042e2ede102bd94236543f5cd5a97a5592 /mm/memcontrol.c | |
parent | 354a4783a2ee5ba1cb5a1442cca8ecd4c0ac6d66 (diff) |
mm: memcontrol: don't pass a NULL memcg to mem_cgroup_end_move()
mem_cgroup_end_move() checks if the passed memcg is NULL, along with a
lengthy comment to explain why this seemingly non-sensical situation is
even possible.
Check in cancel_attach() itself whether can_attach() set up the move
context or not, it's a lot more obvious from there. Then remove the check
and comment in mem_cgroup_end_move().
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a5c9aa4688e8..3cd4f1e0bfb3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1469,12 +1469,7 @@ static void mem_cgroup_start_move(struct mem_cgroup *memcg) | |||
1469 | 1469 | ||
1470 | static void mem_cgroup_end_move(struct mem_cgroup *memcg) | 1470 | static void mem_cgroup_end_move(struct mem_cgroup *memcg) |
1471 | { | 1471 | { |
1472 | /* | 1472 | atomic_dec(&memcg->moving_account); |
1473 | * Now, mem_cgroup_clear_mc() may call this function with NULL. | ||
1474 | * We check NULL in callee rather than caller. | ||
1475 | */ | ||
1476 | if (memcg) | ||
1477 | atomic_dec(&memcg->moving_account); | ||
1478 | } | 1473 | } |
1479 | 1474 | ||
1480 | /* | 1475 | /* |
@@ -5489,7 +5484,8 @@ static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, | |||
5489 | static void mem_cgroup_cancel_attach(struct cgroup_subsys_state *css, | 5484 | static void mem_cgroup_cancel_attach(struct cgroup_subsys_state *css, |
5490 | struct cgroup_taskset *tset) | 5485 | struct cgroup_taskset *tset) |
5491 | { | 5486 | { |
5492 | mem_cgroup_clear_mc(); | 5487 | if (mc.to) |
5488 | mem_cgroup_clear_mc(); | ||
5493 | } | 5489 | } |
5494 | 5490 | ||
5495 | static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, | 5491 | static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, |