One of the criticisms of memory cgroups is that the implementation has
some performance problems. During the 2012 Kernel Summit memcg/mm minisummit, Mel Gorman made the point
that the overhead of memory cgroups is very high, even when memory cgroups
are not in use (i.e., the memory controller is configured in when the
kernel is compiled and is enabled at run time, but there are no cgroups
created, so every process is a member for the root cgroup). This was not
the first time this issue had been noted, since Mel brought it up briefly
at the April 2012 LSF/MM meeting, but this time he had performance profiles
that were generated just prior to the minisummit. They had not been posted
to any mailing list, but he mentioned that the MMTests configuration file to reproduce the
profiles is trivial. One profile showed that 6% of the time for a
page-fault microbenchmark was spent in memcontrol.c (i.e., broadly
speaking, the code that implements memory cgroups). Another benchmark
showed that 15% of the time was spent in memcontrol.c. Andi Kleen
hypothesized that this is likely a cache-conflict issue.
The overhead shown by these benchmarks is considered too great for a
feature that is not in active use. Avoiding the problem by disabling memory
cgroups with a kernel command-line parameter (or building the kernel with
CONFIG_MEMCG disabled) wasn't considered to be an adequate
response to the problem. There were many discussions on how the problem
might be fixed. Glauber Costa suggested that the kernel should not account
for cgroups until the first memory cgroup is created. At that point, it
would be necessary to copy data from the core memory-management statistics;
some synchronization would be necessary, but it should work. Further work
would still be necessary to improve the performance when memory cgroups are
enabled (though, probably there will always be some minimum overhead, even
when the memory cgroups feature is not being actively used), but reducing
the overhead when cgroups are not in use is the immediate problem.
Next: Memory-management performance topics
(
Log in to post comments)