aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/swap.h
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2010-05-24 17:31:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 11:06:56 -0400
commite9d6c157385e4efa61cb8293e425c9d8beba70d3 (patch)
treefca2452b46328c9005b8a4043a22b7b1b4d47d0c /include/linux/swap.h
parent1f0a738868cbfe20ae53a00b7c302c04ef7ab8fc (diff)
tmpfs: insert tmpfs cache pages to inactive list at first
Shaohua Li reported parallel file copy on tmpfs can lead to OOM killer. This is regression of caused by commit 9ff473b9a7 ("vmscan: evict streaming IO first"). Wow, It is 2 years old patch! Currently, tmpfs file cache is inserted active list at first. This means that the insertion doesn't only increase numbers of pages in anon LRU, but it also reduces anon scanning ratio. Therefore, vmscan will get totally confused. It scans almost only file LRU even though the system has plenty unused tmpfs pages. Historically, lru_cache_add_active_anon() was used for two reasons. 1) Intend to priotize shmem page rather than regular file cache. 2) Intend to avoid reclaim priority inversion of used once pages. But we've lost both motivation because (1) Now we have separate anon and file LRU list. then, to insert active list doesn't help such priotize. (2) In past, one pte access bit will cause page activation. then to insert inactive list with pte access bit mean higher priority than to insert active list. Its priority inversion may lead to uninteded lru chun. but it was already solved by commit 645747462 (vmscan: detect mapped file pages used only once). (Thanks Hannes, you are great!) Thus, now we can use lru_cache_add_anon() instead. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reported-by: Shaohua Li <shaohua.li@intel.com> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Reviewed-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Rik van Riel <riel@redhat.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Acked-by: Hugh Dickins <hughd@google.com> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r--include/linux/swap.h10
1 files changed, 0 insertions, 10 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index ec2b7a42b45f..600b03b7732e 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -224,21 +224,11 @@ static inline void lru_cache_add_anon(struct page *page)
224 __lru_cache_add(page, LRU_INACTIVE_ANON); 224 __lru_cache_add(page, LRU_INACTIVE_ANON);
225} 225}
226 226
227static inline void lru_cache_add_active_anon(struct page *page)
228{
229 __lru_cache_add(page, LRU_ACTIVE_ANON);
230}
231
232static inline void lru_cache_add_file(struct page *page) 227static inline void lru_cache_add_file(struct page *page)
233{ 228{
234 __lru_cache_add(page, LRU_INACTIVE_FILE); 229 __lru_cache_add(page, LRU_INACTIVE_FILE);
235} 230}
236 231
237static inline void lru_cache_add_active_file(struct page *page)
238{
239 __lru_cache_add(page, LRU_ACTIVE_FILE);
240}
241
242/* linux/mm/vmscan.c */ 232/* linux/mm/vmscan.c */
243extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 233extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
244 gfp_t gfp_mask, nodemask_t *mask); 234 gfp_t gfp_mask, nodemask_t *mask);