]> Git Repo - linux.git/commit
gfp: add __GFP_NOACCOUNT
authorVladimir Davydov <[email protected]>
Thu, 14 May 2015 22:16:55 +0000 (15:16 -0700)
committerLinus Torvalds <[email protected]>
Fri, 15 May 2015 00:55:51 +0000 (17:55 -0700)
commit8f4fc071b1926d0b20336e2b3f8ab85c94c734c5
treebfd0b008df7bdb9353fbe7a998485e990a9923f3
parent4933f55fe72c86e57efc454dd6e673c7f17af5a3
gfp: add __GFP_NOACCOUNT

Not all kmem allocations should be accounted to memcg.  The following
patch gives an example when accounting of a certain type of allocations to
memcg can effectively result in a memory leak.  This patch adds the
__GFP_NOACCOUNT flag which if passed to kmalloc and friends will force the
allocation to go through the root cgroup.  It will be used by the next
patch.

Note, since in case of kmemleak enabled each kmalloc implies yet another
allocation from the kmemleak_object cache, we add __GFP_NOACCOUNT to
gfp_kmemleak_mask.

Alternatively, we could introduce a per kmem cache flag disabling
accounting for all allocations of a particular kind, but (a) we would not
be able to bypass accounting for kmalloc then and (b) a kmem cache with
this flag set could not be merged with a kmem cache without this flag,
which would increase the number of global caches and therefore
fragmentation even if the memory cgroup controller is not used.

Despite its generic name, currently __GFP_NOACCOUNT disables accounting
only for kmem allocations while user page allocations are always charged.
To catch abusing of this flag, a warning is issued on an attempt of
passing it to mem_cgroup_try_charge.

Signed-off-by: Vladimir Davydov <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Greg Thelen <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: <[email protected]> [4.0.x]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/gfp.h
include/linux/memcontrol.h
mm/kmemleak.c
This page took 0.057484 seconds and 4 git commands to generate.