• Daisuke Nishimura's avatar
    memcg: move charge of file pages · 87946a72
    Daisuke Nishimura authored
    This patch adds support for moving charge of file pages, which include
    normal file, tmpfs file and swaps of tmpfs file.  It's enabled by setting
    bit 1 of <target cgroup>/memory.move_charge_at_immigrate.
    
    Unlike the case of anonymous pages, file pages(and swaps) in the range
    mmapped by the task will be moved even if the task hasn't done page fault,
    i.e.  they might not be the task's "RSS", but other task's "RSS" that maps
    the same file.  And mapcount of the page is ignored(the page can be moved
    even if page_mapcount(page) > 1).  So, conditions that the page/swap
    should be met to be moved is that it must be in the range mmapped by the
    target task and it must be charged to the old cgroup.
    
    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix warning]
    Signed-off-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Balbir Singh <balbir@in.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    87946a72
shmem.c 70.8 KB