• Balbir Singh's avatar
    Implement reclaim from groups over their soft limit · b3108b16
    Balbir Singh authored
    Permit reclaim from memory cgroups on contention (via the direct reclaim
    path).
    
    memory cgroup soft limit reclaim finds the group that exceeds its soft
    limit by the largest number of pages and reclaims pages from it and then
    reinserts the cgroup into its correct place in the rbtree.
    
    Add additional checks to mem_cgroup_hierarchical_reclaim() to detect long
    loops in case all swap is turned off.  The code has been refactored and
    the loop check (loop < 2) has been enhanced for soft limits.  For soft
    limits, we try to do more targetted reclaim.  Instead of bailing out after
    two loops, the routine now reclaims memory proportional to the size by
    which the soft limit is exceeded.  The proportion has been empirically
    determined.
    Signed-off-by: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    Acked-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    b3108b16
memcontrol.c 77.2 KB