aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-12-12 16:51:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 20:38:34 -0500
commit68ae564bbac8eb9ed54ddd2529b0e29ee190b355 (patch)
tree5cef83b5fa072f62091552457e7d0319ce170b98 /mm/memcontrol.c
parent05b0afd73d04109d87f00ccd39f099e217c37263 (diff)
mm, memcg: avoid unnecessary function call when memcg is disabled
While profiling numa/core v16 with cgroup_disable=memory on the command line, I noticed mem_cgroup_count_vm_event() still showed up as high as 0.60% in perftop. This occurs because the function is called extremely often even when memcg is disabled. To fix this, inline the check for mem_cgroup_disabled() so we avoid the unnecessary function call if memcg is disabled. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Glauber Costa <glommer@parallels.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 49d86d06e1dd..7f0e3571df7e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -59,6 +59,8 @@
59#include <trace/events/vmscan.h> 59#include <trace/events/vmscan.h>
60 60
61struct cgroup_subsys mem_cgroup_subsys __read_mostly; 61struct cgroup_subsys mem_cgroup_subsys __read_mostly;
62EXPORT_SYMBOL(mem_cgroup_subsys);
63
62#define MEM_CGROUP_RECLAIM_RETRIES 5 64#define MEM_CGROUP_RECLAIM_RETRIES 5
63static struct mem_cgroup *root_mem_cgroup __read_mostly; 65static struct mem_cgroup *root_mem_cgroup __read_mostly;
64 66
@@ -1015,7 +1017,7 @@ void mem_cgroup_iter_break(struct mem_cgroup *root,
1015 iter != NULL; \ 1017 iter != NULL; \
1016 iter = mem_cgroup_iter(NULL, iter, NULL)) 1018 iter = mem_cgroup_iter(NULL, iter, NULL))
1017 1019
1018void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 1020void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
1019{ 1021{
1020 struct mem_cgroup *memcg; 1022 struct mem_cgroup *memcg;
1021 1023
@@ -1040,7 +1042,7 @@ void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
1040out: 1042out:
1041 rcu_read_unlock(); 1043 rcu_read_unlock();
1042} 1044}
1043EXPORT_SYMBOL(mem_cgroup_count_vm_event); 1045EXPORT_SYMBOL(__mem_cgroup_count_vm_event);
1044 1046
1045/** 1047/**
1046 * mem_cgroup_zone_lruvec - get the lru list vector for a zone and memcg 1048 * mem_cgroup_zone_lruvec - get the lru list vector for a zone and memcg