Re: [RFC PATCH 1/2] mm: rework memcg kernel stack accounting

From: Michal Hocko
Date: Thu Aug 16 2018 - 02:35:19 EST


On Wed 15-08-18 13:20:44, Johannes Weiner wrote:
[...]
> This is completely backwards.
>
> We respect the limits unless there is a *really* strong reason not
> to. The only situations I can think of is during OOM kills to avoid
> memory deadlocks and during packet reception for correctness issues
> (and because the network stack has its own way to reclaim memory).
>
> Relying on some vague future allocations in the process's lifetime to
> fail in order to contain it is crappy and unreliable. And unwinding
> the stack allocation isn't too much complexity to warrant breaking the
> containment rules here, even if it were several steps. But it looks
> like it's nothing more than a 'goto free_stack'.
>
> Please just fix this.

Thinking about it some more (sorry I should have done that in my
previous reply already) I do agree with Johannes. We should really back
off as soon as possible rather than rely on a future action because
this is quite subtle and prone to unexpected behavior.

--
Michal Hocko
SUSE Labs