Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

From: Michal Hocko
Date: Wed Jul 25 2018 - 08:32:41 EST

On Tue 24-07-18 12:05:35, Bruce Merry wrote:
> I've also added some code to memcg_stat_show to report the number of
> cgroups in the hierarchy (iterations in for_each_mem_cgroup_tree).
> Running the script increases it from ~700 to ~41000. The script
> iterates 250,000 times, so only some fraction of the cgroups become
> zombies.

So this is definitely "too many zombies" to delay the collecting of
cumulative stats. Maybe we need to limit the number of zombies and
reclaim them more actively. I have seen Shakeel has posted something but
it looked more on the accounting side from a quick glance.

I can see you are using cgroup v1 so your workaround would be to
memory.force_empty before you remove the group.

Michal Hocko