lkml.org 
[lkml]   [2017]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH -mm -v3 09/12] memcg, THP, swap: Avoid to duplicated charge THP in swap cache
    Date
    From: Huang Ying <ying.huang@intel.com>

    For a THP (Transparent Huge Page), tail_page->mem_cgroup is NULL. So
    to check whether the page is charged already, we need to check the
    head page. This is not an issue before because it is impossible for a
    THP to be in the swap cache before. But after we add delaying
    splitting THP after swapped out support, it is possible now.

    Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
    ---
    mm/memcontrol.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/mm/memcontrol.c b/mm/memcontrol.c
    index c2618bd8ebdd..a627b0fd67ea 100644
    --- a/mm/memcontrol.c
    +++ b/mm/memcontrol.c
    @@ -5407,7 +5407,7 @@ int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
    * in turn serializes uncharging.
    */
    VM_BUG_ON_PAGE(!PageLocked(page), page);
    - if (page->mem_cgroup)
    + if (compound_head(page)->mem_cgroup)
    goto out;

    if (do_swap_account) {
    --
    2.13.2
    \
     
     \ /
      Last update: 2017-07-24 07:22    [W:3.106 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site