From: yulei zhang <yulei.kernel@gmail.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Christian Brauner <christian@brauner.io>,
Cgroups <cgroups@vger.kernel.org>,
benbjiang@tencent.com, Wanpeng Li <kernellwp@gmail.com>,
Yulei Zhang <yuleixzhang@tencent.com>,
Linux MM <linux-mm@kvack.org>, Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <guro@fb.com>
Subject: Re: [RFC 0/7] Introduce memory allocation speed throttle in memcg
Date: Mon, 31 May 2021 20:11:08 +0800 [thread overview]
Message-ID: <CACZOiM3VhYyzCTx4FbW=FF8WB=X46xaV53abqOVL+eHQOs8Reg@mail.gmail.com> (raw)
In-Reply-To: <CALvZod4SoCS6ym8ELTxWd6UwzUp8m_UUdw7oApAhW2WRq0BXqw@mail.gmail.com>
On Thu, May 27, 2021 at 4:52 AM Shakeel Butt <shakeelb@google.com> wrote:
>
> Adding linux-mm and related folks.
>
>
>
> On Wed, May 26, 2021 at 9:18 AM <yulei.kernel@gmail.com> wrote:
> >
> > From: Yulei Zhang <yuleixzhang@tencent.com>
> >
> > In this patch set we present the idea to suppress the memory allocation
> > speed in memory cgroup, which aims to avoid direct reclaim caused by
> > memory allocation burst while under memory pressure.
> >
>
> I am assuming here direct reclaim means global reclaim.
>
Yep.
> > As minimum watermark could be easily broken if certain tasks allocate
> > massive amount of memory in a short period of time, in that case it will
> > trigger the direct memory reclaim and cause unacceptable jitters for
> > latency critical tasks, such as guaranteed pod task in K8s.
> >
> > With memory allocation speed throttle(mst) mechanism we could lower the
> > memory allocation speed in certian cgroup, usually for low priority tasks,
> > so that could avoid the direct memory reclaim in time.
>
> Can you please explain why memory.high is not good enough for your
> use-case? You can orchestrate the memory.high limits in such a way
> that those certain cgroups hit their memory.high limit before causing
> the global reclaim. You might need to dynamically adjust the limits
> based on other workloads or unaccounted memory.
>
Yep, dynamically adjust the memory.high limits can ease the memory pressure
and postpone the global reclaim, but it can easily trigger the oom in
the cgroups,
which may not be suitable in certain usage cases when we want the services
alive. Using throttle to suppress the allocation may help keep the
activities and
doesn't impact others. Thanks.
> >
> > And per-memcg interfaces are introduced under memcg tree, not visiable for
> > root memcg.
> > - <cgroup_root>/<cgroup_name>/memory.alloc_bps
> > - 0 -> means memory speed throttle disabled
> > - non-zero -> value in bytes for memory allocation speed limits
> >
> > - <cgroup_root>/<cgroup_name>/memory.stat:mst_mem_spd_max
> > it records the max memory allocation speed of the memory cgroup in the
> > last period of time slice
> >
> > - <cgroup_root>/<cgroup_name>/memory.stat:mst_nr_throttled
> > it represents the number of times for allocation throttling
> >
> > Yulei Zhang (7):
> > mm: record total charge and max speed counter in memcg
> > mm: introduce alloc_bps to memcg for memory allocation speed throttle
> > mm: memory allocation speed throttle setup in hierarchy
> > mm: introduce slice analysis into memory speed throttle mechanism
> > mm: introduce memory allocation speed throttle
> > mm: record the numbers of memory allocation throttle
> > mm: introduce mst low and min watermark
> >
> > include/linux/memcontrol.h | 23 +++
> > include/linux/page_counter.h | 8 +
> > init/Kconfig | 8 +
> > mm/memcontrol.c | 295 +++++++++++++++++++++++++++++++++++
> > mm/page_counter.c | 39 +++++
> > 5 files changed, 373 insertions(+)
> >
> > --
> > 2.28.0
> >
next prev parent reply other threads:[~2021-05-31 12:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1622043596.git.yuleixzhang@tencent.com>
2021-05-26 20:52 ` Shakeel Butt
2021-05-31 12:11 ` yulei zhang [this message]
2021-05-31 18:20 ` Shakeel Butt
2021-06-01 14:45 ` Chris Down
2021-06-02 9:11 ` yulei zhang
2021-06-02 15:39 ` Shakeel Butt
2021-06-03 10:19 ` yulei zhang
2021-06-03 11:38 ` Chris Down
2021-06-04 10:15 ` yulei zhang
2021-06-04 11:51 ` Chris Down
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='CACZOiM3VhYyzCTx4FbW=FF8WB=X46xaV53abqOVL+eHQOs8Reg@mail.gmail.com' \
--to=yulei.kernel@gmail.com \
--cc=benbjiang@tencent.com \
--cc=cgroups@vger.kernel.org \
--cc=christian@brauner.io \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernellwp@gmail.com \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
--cc=yuleixzhang@tencent.com \
/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