From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>
Subject: Re: [PATCH] mm: memcontrol: reclaim and OOM kill when shrinking memory.max below usage
Date: Thu, 17 Mar 2016 11:23:45 +0300 [thread overview]
Message-ID: <20160317082345.GF18142@esperanza> (raw)
In-Reply-To: <20160316201329.GA15498@cmpxchg.org>
On Wed, Mar 16, 2016 at 01:13:29PM -0700, Johannes Weiner wrote:
> On Wed, Mar 16, 2016 at 06:15:09PM +0300, Vladimir Davydov wrote:
> > On Tue, Mar 15, 2016 at 10:18:48PM -0700, Johannes Weiner wrote:
> > > On Fri, Mar 11, 2016 at 12:19:31PM +0300, Vladimir Davydov wrote:
> > ...
> > > > Come to think of it, shouldn't we restore the old limit and return EBUSY
> > > > if we failed to reclaim enough memory?
> > >
> > > I suspect it's very rare that it would fail. But even in that case
> > > it's probably better to at least not allow new charges past what the
> > > user requested, even if we can't push the level back far enough.
> >
> > It's of course good to set the limit before trying to reclaim memory,
> > but isn't it strange that even if the cgroup's memory can't be reclaimed
> > to meet the new limit (tmpfs files or tasks protected from oom), the
> > write will still succeed? It's a rare use case, but still.
>
> It's not optimal, but there is nothing we can do about it, is there? I
> don't want to go back to the racy semantics that allow the application
> to balloon up again after the limit restriction fails.
>
> > I've one more concern regarding this patch. It's about calling OOM while
> > reclaiming cgroup memory. AFAIU OOM killer can be quite disruptive for a
> > workload, so is it really good to call it when normal reclaim fails?
> >
> > W/o OOM killer you can optimistically try to adjust memory.max and if it
> > fails you can manually kill some processes in the container or restart
> > it or cancel the limit update. With your patch adjusting memory.max
> > never fails, but OOM might kill vital processes rendering the whole
> > container useless. Wouldn't it be better to let the user decide if
> > processes should be killed or not rather than calling OOM forcefully?
>
> Those are the memory.max semantics, though. Why should there be a
> difference between the container growing beyond the limit and the
> limit cutting into the container?
>
> If you don't want OOM kills, set memory.high instead. This way you get
> the memory pressure *and* the chance to do your own killing.
Fair enough.
Thanks,
Vladimir
prev parent reply other threads:[~2016-03-17 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 20:50 [PATCH] mm: memcontrol: reclaim and OOM kill when shrinking memory.max below usage Johannes Weiner
2016-03-11 8:18 ` Michal Hocko
2016-03-11 9:19 ` Vladimir Davydov
2016-03-16 5:18 ` Johannes Weiner
2016-03-16 8:43 ` Michal Hocko
2016-03-16 15:15 ` Vladimir Davydov
2016-03-16 20:13 ` Johannes Weiner
2016-03-17 8:23 ` Vladimir Davydov [this message]
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=20160317082345.GF18142@esperanza \
--to=vdavydov@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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;
as well as URLs for NNTP newsgroup(s).