memcg: export struct mem_cgroup
authorMichal Hocko <[email protected]>
Tue, 8 Sep 2015 22:01:02 +0000 (15:01 -0700)
committerLinus Torvalds <[email protected]>
Tue, 8 Sep 2015 22:35:28 +0000 (15:35 -0700)
commit33398cf2f360c5ce24c8a22436d52a06ad4e5eb5
treec4b967003133425ede67467188d8f96c033185c2
parentb3d9ed3fd872fc074286674ae8595ee880938bbf
memcg: export struct mem_cgroup

mem_cgroup structure is defined in mm/memcontrol.c currently which means
that the code outside of this file has to use external API even for
trivial access stuff.

This patch exports mm_struct with its dependencies and makes some of the
exported functions inlines.  This even helps to reduce the code size a bit
(make defconfig + CONFIG_MEMCG=y)

  text data    bss     dec       hex  filename
  12355346        1823792 1089536 15268674         e8fb42 vmlinux.before
  12354970        1823792 1089536 15268298         e8f9ca vmlinux.after

This is not much (370B) but better than nothing.

We also save a function call in some hot paths like callers of
mem_cgroup_count_vm_event which is used for accounting.

The patch doesn't introduce any functional changes.

[[email protected]: inline memcg_kmem_is_active]
[[email protected]: do not expose type outside of CONFIG_MEMCG]
[[email protected]: memcontrol.h needs eventfd.h for eventfd_ctx]
[[email protected]: export mem_cgroup_from_task() to modules]
Signed-off-by: Michal Hocko <[email protected]>
Reviewed-by: Vladimir Davydov <[email protected]>
Suggested-by: Johannes Weiner <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/memcontrol.h
include/linux/swap.h
include/net/sock.h
mm/memcontrol.c
mm/memory-failure.c
mm/slab_common.c
mm/vmscan.c