]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: memcg: remove optimization of keeping the root_mem_cgroup LRU lists empty
authorJohannes Weiner <jweiner@redhat.com>
Fri, 16 Dec 2011 04:50:32 +0000 (15:50 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Dec 2011 06:01:48 +0000 (17:01 +1100)
root_mem_cgroup, lacking a configurable limit, was never subject to limit
reclaim, so the pages charged to it could be kept off its LRU lists.  They
would be found on the global per-zone LRU lists upon physical memory
pressure and it made sense to avoid uselessly linking them to both lists.

The global per-zone LRU lists are about to go away on memcg-enabled
kernels, with all pages being exclusively linked to their respective
per-memcg LRU lists.  As a result, pages of the root_mem_cgroup must also
be linked to its LRU lists again.  This is purely about the LRU list,
root_mem_cgroup is still not charged.

The overhead is temporary until the double-LRU scheme is going away
completely.

Signed-off-by: Johannes Weiner <jweiner@redhat.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Ying Han <yinghan@google.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c

index 247e1eecc0d5f0e705fd4a827bb2c6d1f6f3125e..1813ec1296f76151ed7050b3ab4c6350b04d7a79 100644 (file)
@@ -1036,8 +1036,6 @@ void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru)
        mz = page_cgroup_zoneinfo(pc->mem_cgroup, page);
        /* huge page split is done under lru_lock. so, we have no races. */
        MEM_CGROUP_ZSTAT(mz, lru) -= 1 << compound_order(page);
-       if (mem_cgroup_is_root(pc->mem_cgroup))
-               return;
        VM_BUG_ON(list_empty(&pc->lru));
        list_del_init(&pc->lru);
 }
@@ -1062,13 +1060,11 @@ void mem_cgroup_rotate_reclaimable_page(struct page *page)
                return;
 
        pc = lookup_page_cgroup(page);
-       /* unused or root page is not rotated. */
+       /* unused page is not rotated. */
        if (!PageCgroupUsed(pc))
                return;
        /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */
        smp_rmb();
-       if (mem_cgroup_is_root(pc->mem_cgroup))
-               return;
        mz = page_cgroup_zoneinfo(pc->mem_cgroup, page);
        list_move_tail(&pc->lru, &mz->lists[lru]);
 }
@@ -1082,13 +1078,11 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru)
                return;
 
        pc = lookup_page_cgroup(page);
-       /* unused or root page is not rotated. */
+       /* unused page is not rotated. */
        if (!PageCgroupUsed(pc))
                return;
        /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */
        smp_rmb();
-       if (mem_cgroup_is_root(pc->mem_cgroup))
-               return;
        mz = page_cgroup_zoneinfo(pc->mem_cgroup, page);
        list_move(&pc->lru, &mz->lists[lru]);
 }
@@ -1120,8 +1114,6 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru)
        /* huge page split is done under lru_lock. so, we have no races. */
        MEM_CGROUP_ZSTAT(mz, lru) += 1 << compound_order(page);
        SetPageCgroupAcctLRU(pc);
-       if (mem_cgroup_is_root(pc->mem_cgroup))
-               return;
        list_add(&pc->lru, &mz->lists[lru]);
 }