• KAMEZAWA Hiroyuki's avatar
    memcg: fix swap accounting · 8a9478ca
    KAMEZAWA Hiroyuki authored
    This patch fixes mis-accounting of swap usage in memcg.
    
    In the current implementation, memcg's swap account is uncharged only when
    swap is completely freed.  But there are several cases where swap cannot
    be freed cleanly.  For handling that, this patch changes that memcg
    uncharges swap account when swap has no references other than cache.
    
    By this, memcg's swap entry accounting can be fully synchronous with the
    application's behavior.
    
    This patch also changes memcg's hooks for swap-out.
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Acked-by: default avatarBalbir Singh <balbir@in.ibm.com>
    Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    Cc: Dhaval Giani <dhaval@linux.vnet.ibm.com>
    Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8a9478ca
memcontrol.c 63.2 KB