Re: [RFC] memory cgroup: my thoughts on memsw

From: Kamezawa Hiroyuki
Date: Wed Sep 10 2014 - 22:06:16 EST


(2014/09/09 19:39), Vladimir Davydov wrote:

For your purpose, you need to implement your method in system-wide way.
It seems crazy to set per-cgroup-anon-limit for avoding system-wide-oom.
You'll need help of system-wide-cgroup-configuration-middleware even if
you have a method in a cgroup. If you say logic should be in OS kernel,
please implement it in a system wide logic rather than cgroup.

What if on global pressure a memory cgroup exceeding its soft limit is
being reclaimed, but not fast enough, because it has a lot of anon
memory? The global OOM won't be triggered then, because there's still
progress, but the system will experience hard pressure due to the
reclaimer runs. How can we detect if we should kill the container or
not? It smells like one more heuristic to vmscan, IMO.


That's you are trying to implement by per-cgroup-anon+swap-limit, the difference
is heuristics by system designer at container creation or heuristics by kernel in
the dynamic way.

I said it should be done by system/cloud-container-scheduler based on notification.

But okay, let me think of kernel help in global reclaim.

- Assume "priority" is a value calculated by "usage - soft limit".

- weighted kswapd/direct reclaim
=> Based on priority of each threads/cgroup, increase "wait" in direct reclaim
if it's contended.
Low prio container will sleep longer until memory contention is fixed.

- weighted anon allocation
similar to above, if memory is contended, page fault speed should be weighted
based on priority(softlimit).

- off cpu direct-reclaim
run direct recalim in workqueue with cpu mask. the cpu mask is a global setting
per numa node, which determines cpus available for being used to reclaim memory.
"How to wait" may affect the performance of system but this can allow masked cpus
to be used for more important jobs.

All of them will give a container-manager time to consinder next action.

Anyway, if swap is slow but necessary, you can use faster swap, now.
It's a good age.

Thanks,
-Kame


--
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/