From: Bruce Merry <bmerry@ska.ac.za>
To: Shakeel Butt <shakeelb@google.com>
Cc: Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines
Date: Wed, 18 Jul 2018 17:37:43 +0200 [thread overview]
Message-ID: <CAOm-9aprLokqi6awMvi0NbkriZBpmvnBA81QhOoHnK7ZEA96fw@mail.gmail.com> (raw)
In-Reply-To: <CALvZod7_vPwqyLBxiecZtREEeY4hioCGnZWVhQx9wVdM8CFcog@mail.gmail.com>
On 18 July 2018 at 17:26, Shakeel Butt <shakeelb@google.com> wrote:
> On Wed, Jul 18, 2018 at 7:29 AM Bruce Merry <bmerry@ska.ac.za> wrote:
> It seems like you are using cgroup-v1. How many nodes are there in
> your memcg tree and also how many cpus does the system have?
>From my original email: "there are 106 memory.stat files in
/sys/fs/cgroup/memory." - is that what you mean by the number of
nodes?
The affected systems all have 8 CPU cores (hyperthreading is disabled).
> Please note that memcg_stat_show or reading memory.stat in cgroup-v1
> is not optimized as cgroup-v2. The function memcg_stat_show() in 4.13
> does ~17 tree walks and then for ~12 of those tree walks, it goes
> through all cpus for each node in the memcg tree. In 4.16,
> a983b5ebee57 ("mm: memcontrol: fix excessive complexity in memory.stat
> reporting") optimizes aways the cpu traversal at the expense of some
> accuracy. Next optimization would be to do just one memcg tree
> traversal similar to cgroup-v2's memory_stat_show().
On most machines it is still fast (1-2ms), and there is no difference
in the number of CPUs and only very small differences in the number of
live memory cgroups, so presumably something else is going on.
> The memcg tree does include all zombie memcgs and these zombies does
> contribute to the memcg_stat_show cost.
That sounds promising. Is there any way to tell how many zombies there
are, and is there any way to deliberately create zombies? If I can
produce zombies that might give me a reliable way to reproduce the
problem, which could then sensibly be tested against newer kernel
versions.
Thanks
Bruce
--
Bruce Merry
Senior Science Processing Developer
SKA South Africa
next prev parent reply other threads:[~2018-07-18 15:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAOm-9arwY3VLUx5189JAR9J7B=Miad9nQjjet_VNdT3i+J+5FA@mail.gmail.com>
2018-07-18 4:23 ` Andrew Morton
2018-07-18 10:42 ` Michal Hocko
2018-07-18 14:29 ` Bruce Merry
2018-07-18 14:47 ` Michal Hocko
2018-07-18 15:27 ` Bruce Merry
2018-07-18 15:33 ` Shakeel Butt
2018-07-18 15:26 ` Shakeel Butt
2018-07-18 15:37 ` Bruce Merry [this message]
2018-07-18 15:49 ` Shakeel Butt
2018-07-18 17:40 ` Bruce Merry
2018-07-18 17:48 ` Shakeel Butt
2018-07-18 17:58 ` Bruce Merry
2018-07-18 18:13 ` Shakeel Butt
2018-07-18 18:43 ` Bruce Merry
2018-07-24 10:05 ` Bruce Merry
2018-07-24 10:50 ` Marinko Catovic
2018-07-25 12:29 ` Michal Hocko
2018-07-25 12:32 ` Michal Hocko
2018-07-26 12:35 ` Bruce Merry
2018-07-26 12:48 ` Michal Hocko
2018-07-26 0:55 ` Singh, Balbir
2018-07-26 6:41 ` Bruce Merry
2018-07-26 8:19 ` 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=CAOm-9aprLokqi6awMvi0NbkriZBpmvnBA81QhOoHnK7ZEA96fw@mail.gmail.com \
--to=bmerry@ska.ac.za \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=vdavydov.dev@gmail.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