• KAMEZAWA Hiroyuki's avatar
    memcg: make mem_cgroup_split_huge_fixup() more efficient · e94c8a9c
    KAMEZAWA Hiroyuki authored
    In split_huge_page(), mem_cgroup_split_huge_fixup() is called to handle
    page_cgroup modifcations.  It takes move_lock_page_cgroup() and modifies
    page_cgroup and LRU accounting jobs and called HPAGE_PMD_SIZE - 1 times.
    
    But thinking again,
      - compound_lock() is held at move_accout...then, it's not necessary
        to take move_lock_page_cgroup().
      - LRU is locked and all tail pages will go into the same LRU as
        head is now on.
      - page_cgroup is contiguous in huge page range.
    
    This patch fixes mem_cgroup_split_huge_fixup() as to be called once per
    hugepage and reduce costs for spliting.
    
    [akpm@linux-foundation.org: fix typo, per Michal]
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: Balbir Singh <bsingharora@gmail.com>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    e94c8a9c
huge_memory.c 63.2 KB