From: Tejun Heo <tj@kernel.org>
To: Benjamin Berg <benjamin@sipsolutions.net>
Cc: Cgroups <cgroups@vger.kernel.org>, Linux MM <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: Memory reclaim protection and cgroup nesting (desktop use)
Date: Thu, 5 Mar 2020 10:12:28 -0500 [thread overview]
Message-ID: <CAOS58YM-HtmxwD7Q7g6ZzGsOJ_vWjHwb=7qpUwuZQEdeRrBifw@mail.gmail.com> (raw)
In-Reply-To: <20200305145554.GA5897@mtj.thefacebook.com>
On Thu, Mar 05, 2020 at 09:55:54AM -0500, Tejun Heo wrote:
> Changing memory limits dynamically can lead to pretty abrupt system
> behaviors depending on how big the swing is but memory.low and io/cpu
> weights should behave fine.
A couple more things which might be helpful.
* memory.min/low are pretty forgiving. Semantically what it tells the
kernel is "reclaim this guy as if the protected amount isn't being
consumed" - if a cgroup consumes 8G and has 4G protection, it'd get
the same reclaim pressure as a sibling whose consuming 4G without
protection. While the range of "good" configuration is pretty wide,
you can definitely push it too far to the point the rest of the
system has to compete too hard for memory. In practice, setting
memory protection to something like 50-75% of expected allocation
seems to work well - it provides ample protection while allowing the
system to be flexible when it needs to be. One important thing that
we learned is that as resource configuration gets more rigid, it can
also become more brittle.
* As for io.weight (and cpu.weight too), while prioritization is
meaningful, what matters the most is avoiding situations where one
consumer overwhelms the device. Simply configuring io.cost correctly
and enabling it with default weights may achieve majority of the
benefits even without specific weight configurations. Please note
that IO control has quite a bit of requirements to function
correctly - it currently works well only on btrfs on physical (not
md or dm) devices with all other IO controllers and wbt disabled.
Hopefully, we'll be able to relax the requirements in the future but
we aren't there yet.
With both memory and IO set up and oomd watching out for swap
depletion, our configurations show almost complete resource isolation
where no matter what we do in unprotected portion of the system it
doesn't affect the performance of the protected portion much even when
the protected portion is running resource hungry latency sensitive
workloads.
Thanks.
--
tejun
next prev parent reply other threads:[~2020-03-05 15:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 9:44 Benjamin Berg
2020-03-04 16:30 ` Tejun Heo
2020-03-04 17:02 ` Jonathan Corbet
2020-03-04 17:10 ` Tejun Heo
2020-03-05 1:29 ` Daniel Xu
2020-03-05 13:13 ` Benjamin Berg
2020-03-05 14:55 ` Tejun Heo
2020-03-05 15:12 ` Tejun Heo [this message]
2020-03-05 15:27 ` Benjamin Berg
2020-03-05 15:39 ` Tejun Heo
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='CAOS58YM-HtmxwD7Q7g6ZzGsOJ_vWjHwb=7qpUwuZQEdeRrBifw@mail.gmail.com' \
--to=tj@kernel.org \
--cc=benjamin@sipsolutions.net \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.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