From: Michal Hocko <mhocko@suse.com>
To: Alexander Sosna <alexander@sosna.de>
Cc: Chris Down <chris@chrisdown.name>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Prevent OOM casualties by enforcing memcg limits
Date: Tue, 27 Apr 2021 16:17:33 +0200 [thread overview]
Message-ID: <YIgc1G496grYBbSH@dhcp22.suse.cz> (raw)
In-Reply-To: <93fcbc37-8c8c-a752-a191-ff8e3dc02eb1@sosna.de>
On Tue 27-04-21 15:43:25, Alexander Sosna wrote:
>
> On 27.04.21 14:11, Michal Hocko wrote:
[...]
> > Well, I am afraid that a reliable and easy solutions would be extremely
> > hard to find. A memcg aware overcommit policy is certainly possible but
> > as I've said it would require an additional accounting, it would be
> > quite unreliable - especially with small limits where the mapped (and
> > accounted) address space is not predominant. A lack of background
> > reclaim (kswapd in the global case) would result in ENOMEM reported even
> > though there is reclaimable memory to satisfy the reserved address space
> > etc.
>
> Thank you very much for this information. Would you share the opinion
> that it would be too hacky to define an arbitrary memory threshold here?
> One could say that below a used memory of X the memory cgroup limit is
> not enforced by denying a malloc(). So that the status quo behavior is
> only altered when the memory usage is above X. This would mitigate the
> problem with small limits and does not introduce new risks or surprises,
> because in this edge case it will behaves identical to the current kernel.
It will not. Please read again about the memory reclaim concern. There
is no background reclaim so (and I believe Chris has mentioned that in
other email) the only way to balance memory consumption (e.g. caches)
would be memory allocations which are excluded from the virtual memory
accounting. That can lead to a hard to predict behavior.
> >> Could
> >> you elaborate on where you see "a lot of fallouts"? overcommit_memory 2
> >> is only set when needed for the desired workload.
> >
> > My above comment was more general to the approach Linux is embracing
> > overcommit and relies on oom killer to handle fallouts. This to change
> > would lead to lot of fallouts. E.g. many syscalls returning unexpected
> > and unhandled ENOMEM etc.
>
> We are talking about a special use case here. Do you see a problem in
> the domain where and how overcommit_memory=2 is used today?
yes I do. I believe I have already provided some real challenges. All
that being said, a virtual memory overcommit control could be
implemented but I am not sure this is worth the additional complexity
and overhead introduced by the additional accounting.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2021-04-27 14:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 20:04 Alexander Sosna
2021-04-27 0:09 ` Chris Down
2021-04-27 6:37 ` Alexander Sosna
2021-04-27 8:08 ` Michal Hocko
2021-04-27 11:01 ` Alexander Sosna
2021-04-27 12:11 ` Michal Hocko
2021-04-27 13:43 ` Alexander Sosna
2021-04-27 14:17 ` Michal Hocko [this message]
2021-04-27 12:26 ` Chris Down
2021-04-27 7:53 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YIgc1G496grYBbSH@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=alexander@sosna.de \
--cc=chris@chrisdown.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox