linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] memcg: bypass root memcg page stat accounting
@ 2013-03-12 10:06 Sha Zhengju
  2013-03-12 10:08 ` [PATCH 1/6] memcg: use global stat directly for root memcg usage Sha Zhengju
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Sha Zhengju @ 2013-03-12 10:06 UTC (permalink / raw)
  To: cgroups, linux-mm
  Cc: mhocko, kamezawa.hiroyu, glommer, akpm, mgorman, Sha Zhengju

Hi,

As we all know, if memcg is enabled but without any non-root memcgs,
all allocated pages belong to root memcg and go through root memcg
statistic routines which brings some overheads.

In this pathset we try to give up accounting stats of root memcg
including CACHE/RSS/SWAP/FILE_MAPPED/PGFAULT/PGMAJFAULT(First attempt
can be found here: https://lkml.org/lkml/2012/12/25/103). But we need
to pay special attention while showing these root memcg numbers in
memcg_stat_show(): as we don't account root memcg stats
anymore, the root_mem_cgroup->stat numbers are actually 0. But we can
fake these figures by using stats of global state and all other memcgs.
Take CACHE stats for example, that is for root memcg:

	nr(MEM_CGROUP_STAT_CACHE) = global_page_state(NR_FILE_PAGES) -
                              sum_of_all_memcg(MEM_CGROUP_STAT_CACHE);

On a 4g memory and 4-core i5 CPU machine, we run Mel's pft test for
performance numbers:

nomemcg  : memcg compile disabled.
vanilla  : memcg enabled, patch not applied.
optimized: memcg enabled, with patch applied.

             optimized    vanilla 
User          405.15      431.27 
System         71.71       73.00 
Elapsed       483.23      510.00 

             optimized    nomemcg 
User          405.15      390.68 
System         71.71       67.21 
Elapsed       483.23      466.15 

Note that elapsed time reduce considerably from 510 to 483 after pathes
have been applied(about ~5%). But there is still some gap between the
patched and memcg-disabled kernel, and we can also do some further works
here(the left-over stats like PGPGIN/PGPGOUT).

I split the patchset to several parts mainly based on their accounting
entry function for the convenience of review:

Sha Zhengju (6):
	memcg: use global stat directly for root memcg usage
	memcg: Don't account root memcg CACHE/RSS stats
	memcg: Don't account root memcg MEM_CGROUP_STAT_FILE_MAPPED stats
	memcg: Don't account root memcg swap stats
	memcg: Don't account root memcg PGFAULT/PGMAJFAULT
	memcg: disable memcg page stat accounting

 include/linux/memcontrol.h |   23 +++++++
 mm/memcontrol.c            |  149 +++++++++++++++++++++++++++++++++++++-------
 2 files changed, 149 insertions(+), 23 deletions(-) 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-03-20  7:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12 10:06 [PATCH 0/6] memcg: bypass root memcg page stat accounting Sha Zhengju
2013-03-12 10:08 ` [PATCH 1/6] memcg: use global stat directly for root memcg usage Sha Zhengju
2013-03-13  1:05   ` Kamezawa Hiroyuki
2013-03-13  8:50     ` Sha Zhengju
2013-03-12 10:09 ` [PATCH 2/6] memcg: Don't account root memcg CACHE/RSS stats Sha Zhengju
2013-03-13  1:12   ` Kamezawa Hiroyuki
2013-03-13  9:09     ` Sha Zhengju
2013-03-20  7:07   ` Glauber Costa
2013-03-12 10:10 ` [PATCH 3/6] memcg: Don't account root memcg MEM_CGROUP_STAT_FILE_MAPPED stats Sha Zhengju
2013-03-12 10:10 ` [PATCH 4/6] memcg: Don't account root memcg swap stats Sha Zhengju
2013-03-12 10:11 ` [PATCH 5/6] memcg: Don't account root memcg PGFAULT/PGMAJFAULT events Sha Zhengju
2013-03-12 10:11 ` [PATCH 6/6] memcg: disable memcg page stat accounting Sha Zhengju
2013-03-20  7:09   ` 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).