• G
    memcg: kmem accounting basic infrastructure · 510fc4e1
    Glauber Costa 提交于
    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: NGlauber Costa <glommer@parallels.com>
    Acked-by: NKamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Acked-by: NMichal 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: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    510fc4e1
Kconfig 55.5 KB