Re: [PATCH 2/2] wait for page writeback when directly reclaiming contiguous areas

Previous thread: [PATCH 1/2] ensure we count pages transitioning inactive via clear_active_flags by Andy Whitcroft on Thursday, August 2, 2007 - 11:18 am. (1 message)

Next thread: [PATCH] Fix section mismatch warnings for drivers/mmc/host by Gabriel C on Thursday, August 2, 2007 - 11:20 am. (2 messages)
From: Andy Whitcroft
Date: Thursday, August 2, 2007 - 11:18 am

Lumpy reclaim works by selecting a lead page from the LRU list and
then selecting pages for reclaim from the order-aligned area of
pages. In the situation were all pages in that region are inactive
and not referenced by any process over time, it works well.

In the situation where there is even light load on the system, the
pages may not free quickly. Out of a area of 1024 pages, maybe only
950 of them are freed when the allocation attempt occurs because
lumpy reclaim returned early.  This patch alters the behaviour of
direct reclaim for large contiguous blocks.

The first attempt to call shrink_page_list() is asynchronous but
if it fails, the pages are submitted a second time and the calling
process waits for the IO to complete. This may stall allocators
waiting for contiguous memory but that should be expected behaviour
for high-order users. It is preferable behaviour to potentially
queueing unnecessary areas for IO. Note that kswapd will not stall
in this fashion.

Changelog:

Changes in V3:
 - remove the typdedef from the enum pageout_io.
 - if we cannot enter fs do not wait for io completion
 - fix spelling in commentary

Changes in V2:
 - remove retry loop
 - fix up active accounting (count deactivate events correctly)
 - use our own sync/async flag type

[apw@shadowen.org: update to version 2]
[apw@shadowen.org: update to version 3]
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 mm/vmscan.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 99ec7fa..b1e9291 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -271,6 +271,12 @@ static void handle_write_error(struct address_space *mapping,
 	unlock_page(page);
 }
 
+/* Request for sync pageout. */
+enum pageout_io {
+	PAGEOUT_IO_ASYNC,
+	PAGEOUT_IO_SYNC,
+};
+
 /* possible outcome of pageout() */
 typedef enum {
 	/* failed to write page out, page ...
From: Andrew Morton
Date: Monday, August 6, 2007 - 12:22 pm

this bit could do with a comment explaining the design decisions, please.
-

Previous thread: [PATCH 1/2] ensure we count pages transitioning inactive via clear_active_flags by Andy Whitcroft on Thursday, August 2, 2007 - 11:18 am. (1 message)

Next thread: [PATCH] Fix section mismatch warnings for drivers/mmc/host by Gabriel C on Thursday, August 2, 2007 - 11:20 am. (2 messages)