Re: [patch 2/2] mm: memcg: hierarchical soft limit reclaim

From: Sha
Date: Wed Jan 18 2012 - 06:25:38 EST


On 01/18/2012 05:25 PM, Johannes Weiner wrote:
On Wed, Jan 18, 2012 at 03:17:25PM +0800, Sha wrote:
I don't think it solve the root of the problem, example:
root
-> A (hard limit 20G, soft limit 12G, usage 20G)
-> A1 ( soft limit 2G, usage 1G)
-> A2 ( soft limit 10G, usage 19G)
->B1 (soft limit 5G, usage 4G)
->B2 (soft limit 5G, usage 15G)

Now A is hitting its hard limit and start hierarchical reclaim under A.
If we choose B1 to go through mem_cgroup_over_soft_limit, it will
return true because its parent A2 has a large usage and will lead to
priority=0 reclaiming. But in fact it should be B2 to be punished.
Because A2 is over its soft limit, the whole hierarchy below it should
be preferred over A1, so both B1 and B2 should be soft limit reclaimed
to be consistent with behaviour at the root level.
Well it is just the behavior that I'm expecting actually. But with my
humble comprehension, I can't catch the soft-limit-based hierarchical
reclaiming under the target cgroup (A2) in the current implementation
or after the patch. Both the current mem_cgroup_soft_reclaim or
shrink_zone select victim sub-cgroup by mem_cgroup_iter, but it
doesn't take soft limit into consideration, do I left anything ?
No, currently soft limits are ignored if pressure originates from
below root_mem_cgroup.

But iff soft limits are applied right now, they are applied
hierarchically, see mem_cgroup_soft_limit_reclaim().
Er... I'm even more confused: mem_cgroup_soft_limit_reclaim indeed
choses the biggest soft-limit excessor first, but in the succeeding reclaim
mem_cgroup_hierarchical_reclaim just selects a child cgroup by css_id
which has nothing to do with soft limit (see mem_cgroup_select_victim).
IMHO, it's not a genuine hierarchical reclaim.
I check this from the latest memcg-devel git tree (branch since-3.1)...

In my opinion, the fact that soft limits are ignored when pressure is
triggered sub-root_mem_cgroup is an artifact of the per-zone tree, so
I allowed soft limits to be taken into account below root_mem_cgroup.

But IMO, this is something different from how soft limit reclaim is
applied once triggered: currently, soft limit reclaim applies to a
whole hierarchy, including all children. And this I left unchanged.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/