• KAMEZAWA Hiroyuki's avatar
    memcg: fix behavior under memory.limit equals to memsw.limit · 22a668d7
    KAMEZAWA Hiroyuki authored
    A user can set memcg.limit_in_bytes == memcg.memsw.limit_in_bytes when the
    user just want to limit the total size of applications, in other words,
    not very interested in memory usage itself.  In this case, swap-out will
    be done only by global-LRU.
    
    But, under current implementation, memory.limit_in_bytes is checked at
    first and try_to_free_page() may do swap-out.  But, that swap-out is
    useless for memsw.limit_in_bytes and the thread may hit limit again.
    
    This patch tries to fix the current behavior at memory.limit ==
    memsw.limit case.  And documentation is updated to explain the behavior of
    this special case.
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Cc: Balbir Singh <balbir@in.ibm.com>
    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>
    22a668d7
memcontrol.c 63.6 KB