• Daisuke Nishimura's avatar
    memcg: move charges of anonymous page · 4ffef5fe
    Daisuke Nishimura authored
    This patch is the core part of this move-charge-at-task-migration feature.
     It implements functions to move charges of anonymous pages mapped only by
    the target task.
    
    Implementation:
    - define struct move_charge_struct and a valuable of it(mc) to remember the
      count of pre-charges and other information.
    - At can_attach(), get anon_rss of the target mm, call __mem_cgroup_try_charge()
      repeatedly and count up mc.precharge.
    - At attach(), parse the page table, find a target page to be move, and call
      mem_cgroup_move_account() about the page.
    - Cancel all precharges if mc.precharge > 0 on failure or at the end of
      task move.
    
    [akpm@linux-foundation.org: a little simplification]
    Signed-off-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
    Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    Cc: Paul Menage <menage@google.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4ffef5fe
memcontrol.c 94.3 KB