• Ying Han's avatar
    memcg: reclaim memory from nodes in round-robin order · 889976db
    Ying Han authored
    Presently, memory cgroup's direct reclaim frees memory from the current
    node.  But this has some troubles.  Usually when a set of threads works in
    a cooperative way, they tend to operate on the same node.  So if they hit
    limits under memcg they will reclaim memory from themselves, damaging the
    active working set.
    
    For example, assume 2 node system which has Node 0 and Node 1 and a memcg
    which has 1G limit.  After some work, file cache remains and the usages
    are
    
       Node 0:  1M
       Node 1:  998M.
    
    and run an application on Node 0, it will eat its foot before freeing
    unnecessary file caches.
    
    This patch adds round-robin for NUMA and adds equal pressure to each node.
    When using cpuset's spread memory feature, this will work very well.
    
    But yes, a better algorithm is needed.
    
    [akpm@linux-foundation.org: comment editing]
    [kamezawa.hiroyu@jp.fujitsu.com: fix time comparisons]
    Signed-off-by: default avatarYing Han <yinghan@google.com>
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Balbir Singh <balbir@in.ibm.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    889976db
memcontrol.c 136 KB