• D
    memcg: fix mem_cgroup_shrink_usage() · ae3abae6
    Daisuke Nishimura 提交于
    Current mem_cgroup_shrink_usage() has two problems.
    
    1. It doesn't call mem_cgroup_out_of_memory and doesn't update
       last_oom_jiffies, so pagefault_out_of_memory invokes global OOM.
    
    2. Considering hierarchy, shrinking has to be done from the
       mem_over_limit, not from the memcg which the page would be charged to.
    
    mem_cgroup_try_charge_swapin() does all of these things properly, so we
    use it and call cancel_charge_swapin when it succeeded.
    
    The name of "shrink_usage" is not appropriate for this behavior, so we
    change it too.
    Signed-off-by: NDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Acked-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Li Zefan <lizf@cn.fujitsu.cn>
    Cc: Paul Menage <menage@google.com>
    Cc: Dhaval Giani <dhaval@linux.vnet.ibm.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    ae3abae6
shmem.c 68.9 KB