mm: make get_scan_ratio() safe for memcg
Currently, get_scan_ratio() always calculate the balancing value for global reclaim and memcg reclaim doesn't use it. Therefore it doesn't have scan_global_lru() condition. However, we plan to expand get_scan_ratio() to be usable for memcg too, latter. Then, The dependency code of global reclaim in the get_scan_ratio() insert into scan_global_lru() condision explictly. This patch doesn't have any functional change. Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
					parent
					
						
							
								c9f299d986
							
						
					
				
			
			
				commit
				
					
						eeee9a8cd1
					
				
			
		
					 1 changed files with 9 additions and 6 deletions
				
			
		
							
								
								
									
										15
									
								
								mm/vmscan.c
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								mm/vmscan.c
									
										
									
									
									
								
							| 
						 | 
					@ -1376,13 +1376,16 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
 | 
				
			||||||
		zone_nr_pages(zone, sc, LRU_INACTIVE_ANON);
 | 
							zone_nr_pages(zone, sc, LRU_INACTIVE_ANON);
 | 
				
			||||||
	file  = zone_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
 | 
						file  = zone_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
 | 
				
			||||||
		zone_nr_pages(zone, sc, LRU_INACTIVE_FILE);
 | 
							zone_nr_pages(zone, sc, LRU_INACTIVE_FILE);
 | 
				
			||||||
	free  = zone_page_state(zone, NR_FREE_PAGES);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* If we have very few page cache pages, force-scan anon pages. */
 | 
						if (scan_global_lru(sc)) {
 | 
				
			||||||
	if (unlikely(file + free <= zone->pages_high)) {
 | 
							free  = zone_page_state(zone, NR_FREE_PAGES);
 | 
				
			||||||
		percent[0] = 100;
 | 
							/* If we have very few page cache pages,
 | 
				
			||||||
		percent[1] = 0;
 | 
							   force-scan anon pages. */
 | 
				
			||||||
		return;
 | 
							if (unlikely(file + free <= zone->pages_high)) {
 | 
				
			||||||
 | 
								percent[0] = 100;
 | 
				
			||||||
 | 
								percent[1] = 0;
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue