aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-12-10 18:43:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:06 -0500
commitbc2f2e7ffe5b6292c74ee1206d6ca303e13886b2 (patch)
treeb1282dbc1b6f76da3e48ba8b6ba785b51159e5ec /mm/memcontrol.c
parent6f7c97e80b813879a17c0e8ef343cc414761e6f5 (diff)
memcg: simplify unreclaimable groups handling in soft limit reclaim
If we fail to reclaim anything from a cgroup during a soft reclaim pass we want to get the next largest cgroup exceeding its soft limit. To achieve this, we should obviously remove the current group from the tree and then pick the largest group. Currently we have a weird loop instead. Let's simplify it. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> 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.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3a628435f36a..975207a9cc65 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3518,34 +3518,16 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
3518 nr_reclaimed += reclaimed; 3518 nr_reclaimed += reclaimed;
3519 *total_scanned += nr_scanned; 3519 *total_scanned += nr_scanned;
3520 spin_lock_irq(&mctz->lock); 3520 spin_lock_irq(&mctz->lock);
3521 __mem_cgroup_remove_exceeded(mz, mctz);
3521 3522
3522 /* 3523 /*
3523 * If we failed to reclaim anything from this memory cgroup 3524 * If we failed to reclaim anything from this memory cgroup
3524 * it is time to move on to the next cgroup 3525 * it is time to move on to the next cgroup
3525 */ 3526 */
3526 next_mz = NULL; 3527 next_mz = NULL;
3527 if (!reclaimed) { 3528 if (!reclaimed)
3528 do { 3529 next_mz = __mem_cgroup_largest_soft_limit_node(mctz);
3529 /* 3530
3530 * Loop until we find yet another one.
3531 *
3532 * By the time we get the soft_limit lock
3533 * again, someone might have aded the
3534 * group back on the RB tree. Iterate to
3535 * make sure we get a different mem.
3536 * mem_cgroup_largest_soft_limit_node returns
3537 * NULL if no other cgroup is present on
3538 * the tree
3539 */
3540 next_mz =
3541 __mem_cgroup_largest_soft_limit_node(mctz);
3542 if (next_mz == mz)
3543 css_put(&next_mz->memcg->css);
3544 else /* next_mz == NULL or other memcg */
3545 break;
3546 } while (1);
3547 }
3548 __mem_cgroup_remove_exceeded(mz, mctz);
3549 excess = soft_limit_excess(mz->memcg); 3531 excess = soft_limit_excess(mz->memcg);
3550 /* 3532 /*
3551 * One school of thought says that we should not add 3533 * One school of thought says that we should not add