diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-05-26 19:25:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:12:35 -0400 |
commit | 246e87a9393448c20873bc5dee64be68ed559e24 (patch) | |
tree | a17016142b267fcba2e3be9908f8138c8dcb3f3a /include | |
parent | 889976dbcb1218119fdd950fb7819084e37d7d37 (diff) |
memcg: fix get_scan_count() for small targets
During memory reclaim we determine the number of pages to be scanned per
zone as
(anon + file) >> priority.
Assume
scan = (anon + file) >> priority.
If scan < SWAP_CLUSTER_MAX, the scan will be skipped for this time and
priority gets higher. This has some problems.
1. This increases priority as 1 without any scan.
To do scan in this priority, amount of pages should be larger than 512M.
If pages>>priority < SWAP_CLUSTER_MAX, it's recorded and scan will be
batched, later. (But we lose 1 priority.)
If memory size is below 16M, pages >> priority is 0 and no scan in
DEF_PRIORITY forever.
2. If zone->all_unreclaimabe==true, it's scanned only when priority==0.
So, x86's ZONE_DMA will never be recoverred until the user of pages
frees memory by itself.
3. With memcg, the limit of memory can be small. When using small memcg,
it gets priority < DEF_PRIORITY-2 very easily and need to call
wait_iff_congested().
For doing scan before priorty=9, 64MB of memory should be used.
Then, this patch tries to scan SWAP_CLUSTER_MAX of pages in force...when
1. the target is enough small.
2. it's kswapd or memcg reclaim.
Then we can avoid rapid priority drop and may be able to recover
all_unreclaimable in a small zones. And this patch removes nr_saved_scan.
This will allow scanning in this priority even when pages >> priority is
very small.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Ying Han <yinghan@google.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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mmzone.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 217bcf6bca77..29312bdf119f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -273,11 +273,6 @@ struct zone_reclaim_stat { | |||
273 | */ | 273 | */ |
274 | unsigned long recent_rotated[2]; | 274 | unsigned long recent_rotated[2]; |
275 | unsigned long recent_scanned[2]; | 275 | unsigned long recent_scanned[2]; |
276 | |||
277 | /* | ||
278 | * accumulated for batching | ||
279 | */ | ||
280 | unsigned long nr_saved_scan[NR_LRU_LISTS]; | ||
281 | }; | 276 | }; |
282 | 277 | ||
283 | struct zone { | 278 | struct zone { |