Teach page reclaim to understand synchronous ->writepage implementations.

If ->writepage completed I/O prior to returning we can proceed to reclaim the
page without giving it another trip around the LRU.

This is beneficial for ramdisk-backed S_ISREG files: we can reclaim the file's
pages as fast as the ramdisk driver needs to allocate them and this prevents
I/O errors due to OOM in rd_blkdev_pagecache_IO().


---

 25-akpm/mm/vmscan.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

diff -puN mm/vmscan.c~vmscan-handle-synchronous-writepage mm/vmscan.c
--- 25/mm/vmscan.c~vmscan-handle-synchronous-writepage	Fri May 21 17:05:39 2004
+++ 25-akpm/mm/vmscan.c	Fri May 21 17:05:39 2004
@@ -373,7 +373,16 @@ shrink_list(struct list_head *page_list,
 					/* synchronous write or broken a_ops? */
 					ClearPageReclaim(page);
 				}
-				goto keep;
+				if (PageWriteback(page) || PageDirty(page))
+					goto keep;
+				/*
+				 * A synchronous write - probably a ramdisk.  Go
+				 * ahead and try to reclaim the page.
+				 */
+				if (TestSetPageLocked(page))
+					goto keep;
+				if (PageWriteback(page))
+					goto keep_locked;
 			}
 		}
 

_