Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

From: Johannes Weiner
Date: Wed Oct 04 2017 - 16:42:09 EST

On Wed, Oct 04, 2017 at 01:27:14PM -0700, David Rientjes wrote:
> By only considering leaf memcgs, does this penalize users if their memcg
> becomes oc->chosen_memcg purely because it has aggregated all of its
> processes to be members of that memcg, which would otherwise be the
> standard behavior?
> What prevents me from spreading my memcg with N processes attached over N
> child memcgs instead so that memcg_oom_badness() becomes very small for
> each child memcg specifically to avoid being oom killed?

It's no different from forking out multiple mm to avoid being the
biggest process.

It's up to the parent to enforce limits on that group and prevent you
from being able to cause global OOM in the first place, in particular
if you delegate to untrusted and potentially malicious users.