mm: memcontrol: micro-optimize mem_cgroup_split_huge_fixup()
authorMichal Hocko <mhocko@suse.cz>
Wed, 10 Dec 2014 23:43:51 +0000 (15:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:07 +0000 (17:41 -0800)
Don't call lookup_page_cgroup() when memcg is disabled.

Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index 420461bcaefd3e8bc2e933f5b5a43824cea06912..8c10d4ca9c3f3be45bd87a039359f1424a63c88c 100644 (file)
@@ -3174,7 +3174,7 @@ static inline void memcg_unregister_all_caches(struct mem_cgroup *memcg)
  */
 void mem_cgroup_split_huge_fixup(struct page *head)
 {
-       struct page_cgroup *head_pc = lookup_page_cgroup(head);
+       struct page_cgroup *head_pc;
        struct page_cgroup *pc;
        struct mem_cgroup *memcg;
        int i;
@@ -3182,6 +3182,8 @@ void mem_cgroup_split_huge_fixup(struct page *head)
        if (mem_cgroup_disabled())
                return;
 
+       head_pc = lookup_page_cgroup(head);
+
        memcg = head_pc->mem_cgroup;
        for (i = 1; i < HPAGE_PMD_NR; i++) {
                pc = head_pc + i;