linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/4] bypass charges if memcg is not used
@ 2012-09-25  8:52 Glauber Costa
  2012-09-25  8:52 ` [RFC 1/4] memcg: provide root figures from system totals Glauber Costa
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Glauber Costa @ 2012-09-25  8:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: cgroups, linux-mm, devel, Peter Zijlstra, Michal Hocko,
	Kamezawa Hiroyuki, Johannes Weiner, Mel Gorman, Andrew Morton

For the special case that memcg is compiled in (a quite common case) but not in
use (also a common case), we are still seeing a huge performance impact. Mel
Gorman demonstrated in the Kernel Summit, mm mini summit, that depending on the
hardware, this can vary between 6 and 15 %.

I am proposing in this initial patch, that we take the strategy of bypassing
the memcg code with static branches. We can flip it on when the first memcg
gets created. Up to that moment, we'll mostly have a bunch of nops.

This patch also defers the call to page_cgroup_init() to that moment. This means
that the memory used by page_cgroup structure won't be wasted until we really
need it. We can do the same with the memory used for swap, if needed.

There are many edges to be trimmed, but I wanted to send this early to collect
feedback. I coded this enough to get numbers out of it. I tested it in a 24-way
2-socket Intel box, 24 Gb mem. I used Mel Gorman's pft test, that he used to
demonstrate this problem back in the Kernel Summit. There are three kernels:

nomemcg  : memcg compile disabled.
base     : memcg enabled, patch not applied.
bypassed : memcg enabled, with patch applied.

                base    bypassed
User          109.12      105.64
System       1646.84     1597.98
Elapsed       229.56      215.76

             nomemcg    bypassed
User          104.35      105.64
System       1578.19     1597.98
Elapsed       212.33      215.76

So as one can see, the difference between base and nomemcg in terms
of both system time and elapsed time is quite drastic, and consistent
with the figures shown by Mel Gorman in the Kernel summit. This is a
~ 7 % drop in performance, just by having memcg enabled. memcg functions
appear heavily in the profiles, even if all tasks lives in the root
memcg.

With bypassed kernel, we drop this down to 1.5 %, which starts to fall
in the acceptable range. More investigation is needed to see if we can
claim that last percent back, but I believe at last part of it should
be.


Glauber Costa (4):
  memcg: provide root figures from system totals
  memcg: make it suck faster
  memcg: do not call page_cgroup_init at system_boot
  memcg: do not walk all the way to the root for memcg

 include/linux/memcontrol.h  | 56 ++++++++++++++++++++++++++------
 include/linux/page_cgroup.h | 20 +++++++++---
 init/main.c                 |  1 -
 mm/memcontrol.c             | 78 ++++++++++++++++++++++++++++++++++++++++-----
 mm/page_cgroup.c            | 44 +++++++++++++++++++------
 5 files changed, 165 insertions(+), 34 deletions(-)

-- 
1.7.11.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-02  9:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-25  8:52 [RFC 0/4] bypass charges if memcg is not used Glauber Costa
2012-09-25  8:52 ` [RFC 1/4] memcg: provide root figures from system totals Glauber Costa
2012-10-01 17:00   ` Michal Hocko
2012-10-02  9:15     ` Glauber Costa
2012-10-02  9:34       ` Michal Hocko
2012-09-25  8:52 ` [RFC 2/4] memcg: make it suck faster Glauber Costa
2012-09-25 21:02   ` Andrew Morton
2012-09-26  8:53     ` Glauber Costa
2012-09-26  9:03       ` Daniel P. Berrange
2012-09-25  8:52 ` [RFC 3/4] memcg: do not call page_cgroup_init at system_boot Glauber Costa
2012-09-25  8:52 ` [RFC 4/4] memcg: do not walk all the way to the root for memcg Glauber Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).