aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorGlauber Costa2012-12-18 16:21:47 -0600
committerLinus Torvalds2012-12-18 17:02:12 -0600
commit510fc4e11b772fd60f2c545c64d4c55abd07ce36 (patch)
treed4e5b773b87e35d91b6a569bf43dc3424ac1968d /init
parent86ae53e1a138a3295c04ae69bf404be00244a381 (diff)
downloadkernel-omap-510fc4e11b772fd60f2c545c64d4c55abd07ce36.tar.gz
kernel-omap-510fc4e11b772fd60f2c545c64d4c55abd07ce36.tar.xz
kernel-omap-510fc4e11b772fd60f2c545c64d4c55abd07ce36.zip
memcg: kmem accounting basic infrastructure
Add the basic infrastructure for the accounting of kernel memory. To control that, the following files are created: * memory.kmem.usage_in_bytes * memory.kmem.limit_in_bytes * memory.kmem.failcnt * memory.kmem.max_usage_in_bytes They have the same meaning of their user memory counterparts. They reflect the state of the "kmem" res_counter. Per cgroup kmem memory accounting is not enabled until a limit is set for the group. Once the limit is set the accounting cannot be disabled for that group. This means that after the patch is applied, no behavioral changes exists for whoever is still using memcg to control their memory usage, until memory.kmem.limit_in_bytes is set for the first time. We always account to both user and kernel resource_counters. This effectively means that an independent kernel limit is in place when the limit is set to a lower value than the user memory. A equal or higher value means that the user limit will always hit first, meaning that kmem is effectively unlimited. People who want to track kernel memory but not limit it, can set this limit to a very high number (like RESOURCE_MAX - 1page - that no one will ever hit, or equal to the user memory) [akpm@linux-foundation.org: MEMCG_MMEM only works with slab and slub] Signed-off-by: Glauber Costa <glommer@parallels.com> Acked-by: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Tejun Heo <tj@kernel.org> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Frederic Weisbecker <fweisbec@redhat.com> Cc: Greg Thelen <gthelen@google.com> Cc: JoonSoo Kim <js1304@gmail.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig1
1 files changed, 1 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 675d8a2326cf..19ccb33c99d9 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -882,6 +882,7 @@ config MEMCG_SWAP_ENABLED
882config MEMCG_KMEM 882config MEMCG_KMEM
883 bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)" 883 bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)"
884 depends on MEMCG && EXPERIMENTAL 884 depends on MEMCG && EXPERIMENTAL
885 depends on SLUB || SLAB
885 default n 886 default n
886 help 887 help
887 The Kernel Memory extension for Memory Resource Controller can limit 888 The Kernel Memory extension for Memory Resource Controller can limit