public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] vm early reclaim orphaned pages
@ 2005-06-17  3:23 Nick Piggin
  2005-06-17  3:34 ` Andrew Morton
  2005-06-20  7:23 ` [patch 1/2] vm early reclaim orphaned pages (take 2) Nick Piggin
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Piggin @ 2005-06-17  3:23 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: andrea, mason

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

This any good?

The workload in question is bonnie, with ext3 data=ordered.
Chris has some ReiserFS workloads where orphaned pages build
up that I think were improved.


-- 
SUSE Labs, Novell Inc.



[-- Attachment #2: vm-early-reclaim-orphaned.patch --]
[-- Type: text/x-patch, Size: 1323 bytes --]

We have workloads where orphaned pages build up and appear to slow
the system down when it starts reclaiming memory.

Stripping the referenced bit from orphaned pages and putting them
on the end of the inactive list should help improve reclaim.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/truncate.c
===================================================================
--- linux-2.6.orig/mm/truncate.c	2005-06-01 16:09:34.000000000 +1000
+++ linux-2.6/mm/truncate.c	2005-06-17 13:01:01.090334444 +1000
@@ -45,11 +45,30 @@
 static void
 truncate_complete_page(struct address_space *mapping, struct page *page)
 {
+	int orphaned = 0;
+	
 	if (page->mapping != mapping)
 		return;
 
 	if (PagePrivate(page))
-		do_invalidatepage(page, 0);
+		orphaned = !(do_invalidatepage(page, 0));
+
+	if (orphaned) {
+		/*
+		 * Put orphaned pagecache on the end of the inactive
+		 * list so it can get reclaimed quickly.
+		 */
+		unsigned long flags;
+		struct zone *zone = page_zone(page);
+		spin_lock_irqsave(&zone->lru_lock, flags);
+		ClearPageReferenced(page);
+		if (PageLRU(page)) {
+			list_move_tail(&page->lru, &zone->inactive_list);
+			if (PageActive(page))
+				ClearPageActive(page);
+		}
+		spin_unlock_irqrestore(&zone->lru_lock, flags);
+	}
 
 	clear_page_dirty(page);
 	ClearPageUptodate(page);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-06-23  3:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-17  3:23 [patch] vm early reclaim orphaned pages Nick Piggin
2005-06-17  3:34 ` Andrew Morton
2005-06-17  3:42   ` Nick Piggin
2005-06-17  4:20     ` Andrea Arcangeli
2005-06-20  7:23 ` [patch 1/2] vm early reclaim orphaned pages (take 2) Nick Piggin
2005-06-20  7:24   ` [patch 2/2] stats for orphaned pages (-mm only) Nick Piggin
2005-06-20  7:36     ` Andrew Morton
2005-06-20  7:49       ` Nick Piggin
2005-06-20  7:31   ` [patch 1/2] vm early reclaim orphaned pages (take 2) Andrew Morton
2005-06-20  7:32   ` Nick Piggin
2005-06-23  2:51     ` Rik Van Riel
2005-06-23  3:05       ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox