• Andres Lagar-Cavilla's avatar
    tmpfs: mem_cgroup charge fault to vm_mm not current mm · 9e18eb29
    Andres Lagar-Cavilla authored
    Although shmem_fault() has been careful to count a major fault to vm_mm,
    shmem_getpage_gfp() has been careless in charging a remote access fault
    to current->mm owner's memcg instead of to vma->vm_mm owner's memcg:
    that is inconsistent with all the mem_cgroup charging on remote access
    faults in mm/memory.c.
    
    Fix it by passing fault_mm along with fault_type to
    shmem_get_page_gfp(); but in that case, now knowing the right mm, it's
    better for it to handle the PGMAJFAULT updates itself.
    
    And let's keep this clutter out of most callers' way: change the common
    shmem_getpage() wrapper to hide fault_mm and fault_type as well as gfp.
    Signed-off-by: default avatarAndres Lagar-Cavilla <andreslc@google.com>
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Andres Lagar-Cavilla <andreslc@google.com>
    Cc: Yang Shi <yang.shi@linaro.org>
    Cc: Ning Qu <quning@gmail.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Konstantin Khlebnikov <koct9i@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9e18eb29
shmem.c 90.2 KB