forked from mirrors/linux
		
	memcg: add the soft_limit reclaim in global direct reclaim.
We recently added the change in global background reclaim which counts the return value of soft_limit reclaim. Now this patch adds the similar logic on global direct reclaim. We should skip scanning global LRU on shrink_zone if soft_limit reclaim does enough work. This is the first step where we start with counting the nr_scanned and nr_reclaimed from soft_limit reclaim into global scan_control. Signed-off-by: Ying Han <yinghan@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Rik van Riel <riel@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									0ae5e89c60
								
							
						
					
					
						commit
						d149e3b25d
					
				
					 1 changed files with 14 additions and 2 deletions
				
			
		
							
								
								
									
										16
									
								
								mm/vmscan.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								mm/vmscan.c
									
									
									
									
									
								
							| 
						 | 
					@ -1977,11 +1977,14 @@ static void shrink_zone(int priority, struct zone *zone,
 | 
				
			||||||
 * If a zone is deemed to be full of pinned pages then just give it a light
 | 
					 * If a zone is deemed to be full of pinned pages then just give it a light
 | 
				
			||||||
 * scan then give up on it.
 | 
					 * scan then give up on it.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void shrink_zones(int priority, struct zonelist *zonelist,
 | 
					static unsigned long shrink_zones(int priority, struct zonelist *zonelist,
 | 
				
			||||||
					struct scan_control *sc)
 | 
										struct scan_control *sc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct zoneref *z;
 | 
						struct zoneref *z;
 | 
				
			||||||
	struct zone *zone;
 | 
						struct zone *zone;
 | 
				
			||||||
 | 
						unsigned long nr_soft_reclaimed;
 | 
				
			||||||
 | 
						unsigned long nr_soft_scanned;
 | 
				
			||||||
 | 
						unsigned long total_scanned = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for_each_zone_zonelist_nodemask(zone, z, zonelist,
 | 
						for_each_zone_zonelist_nodemask(zone, z, zonelist,
 | 
				
			||||||
					gfp_zone(sc->gfp_mask), sc->nodemask) {
 | 
										gfp_zone(sc->gfp_mask), sc->nodemask) {
 | 
				
			||||||
| 
						 | 
					@ -1998,8 +2001,17 @@ static void shrink_zones(int priority, struct zonelist *zonelist,
 | 
				
			||||||
				continue;	/* Let kswapd poll it */
 | 
									continue;	/* Let kswapd poll it */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							nr_soft_scanned = 0;
 | 
				
			||||||
 | 
							nr_soft_reclaimed = mem_cgroup_soft_limit_reclaim(zone,
 | 
				
			||||||
 | 
												sc->order, sc->gfp_mask,
 | 
				
			||||||
 | 
												&nr_soft_scanned);
 | 
				
			||||||
 | 
							sc->nr_reclaimed += nr_soft_reclaimed;
 | 
				
			||||||
 | 
							total_scanned += nr_soft_scanned;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		shrink_zone(priority, zone, sc);
 | 
							shrink_zone(priority, zone, sc);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return total_scanned;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool zone_reclaimable(struct zone *zone)
 | 
					static bool zone_reclaimable(struct zone *zone)
 | 
				
			||||||
| 
						 | 
					@ -2064,7 +2076,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
 | 
				
			||||||
		sc->nr_scanned = 0;
 | 
							sc->nr_scanned = 0;
 | 
				
			||||||
		if (!priority)
 | 
							if (!priority)
 | 
				
			||||||
			disable_swap_token();
 | 
								disable_swap_token();
 | 
				
			||||||
		shrink_zones(priority, zonelist, sc);
 | 
							total_scanned += shrink_zones(priority, zonelist, sc);
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Don't shrink slabs when reclaiming memory from
 | 
							 * Don't shrink slabs when reclaiming memory from
 | 
				
			||||||
		 * over limit cgroups
 | 
							 * over limit cgroups
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue