linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] page aging for 2.2.16
@ 2000-06-08  9:16 Neil Schemenauer
  2000-06-08 12:41 ` Matthias Andree
  2000-07-09 15:30 ` Ed Tomlinson
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Schemenauer @ 2000-06-08  9:16 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel

This patch seems to significantly improve the interactive
performance of 2.2.16.  Without the patch XMMS and the mouse
pointer will stop responding for seconds at a time while running
Bonnie.  With the patch everything is smooth.

I timed a kernel compile with -j 20 to test the cost of the
aging.  It does not seem to make a significant difference (3
seconds slower).  Bonnie reports slightly higher IO figures
with the patch.  I don't think the change is significant.

Comments appreciated.

    Neil

-- 
"If you're a great programmer, you make all the routines depend on each
other, so little mistakes can really hurt you." -- Bill Gates, ca. 1985.


diff -ru linux-2.2/include/linux/mm.h linux-age/include/linux/mm.h
--- linux-2.2/include/linux/mm.h	Thu Jun  8 00:30:02 2000
+++ linux-age/include/linux/mm.h	Thu Jun  8 01:49:42 2000
@@ -129,7 +129,11 @@
 	struct wait_queue *wait;
 	struct page **pprev_hash;
 	struct buffer_head * buffers;
+	int age;
 } mem_map_t;
+
+#define PAGE_AGE_INITIAL 1	/* age for pages just mapped */
+#define PAGE_AGE_YOUNG 2	/* age for pages recently referenced */
 
 /* Page flag bit values */
 #define PG_locked		 0
diff -ru linux-2.2/mm/filemap.c linux-age/mm/filemap.c
--- linux-2.2/mm/filemap.c	Thu Jun  8 00:30:26 2000
+++ linux-age/mm/filemap.c	Thu Jun  8 01:44:16 2000
@@ -147,8 +147,6 @@
 
 	page = mem_map + clock;
 	do {
-		int referenced;
-
 		/* This works even in the presence of PageSkip because
 		 * the first two entries at the beginning of a hole will
 		 * be marked, not just the first.
@@ -165,12 +163,20 @@
 			clock = page - mem_map;
 		}
 		
+		if (test_and_clear_bit(PG_referenced, &page->flags)) {
+			page->age = PAGE_AGE_YOUNG;
+			continue;
+		}
+
+		if (page->age > 0) {
+			page->age--;
+			continue;
+		}
+
 		/* We can't free pages unless there's just one user */
 		if (atomic_read(&page->count) != 1)
 			continue;
 
-		referenced = test_and_clear_bit(PG_referenced, &page->flags);
-
 		if (PageLocked(page))
 			continue;
 
@@ -179,20 +185,11 @@
 
 		count--;
 
-		/*
-		 * Is it a page swap page? If so, we want to
-		 * drop it if it is no longer used, even if it
-		 * were to be marked referenced..
-		 */
+		/* Is it a page swap page? Drop it, its old. */
 		if (PageSwapCache(page)) {
-			if (referenced && swap_count(page->offset) != 1)
-				continue;
 			delete_from_swap_cache(page);
 			return 1;
 		}	
-
-		if (referenced)
-			continue;
 
 		/* Is it a buffer page? */
 		if (page->buffers) {
diff -ru linux-2.2/mm/page_alloc.c linux-age/mm/page_alloc.c
--- linux-2.2/mm/page_alloc.c	Thu Jun  8 00:30:26 2000
+++ linux-age/mm/page_alloc.c	Thu Jun  8 01:49:50 2000
@@ -129,6 +129,7 @@
 		if (PageSwapCache(page))
 			panic ("Freeing swap cache page");
 		page->flags &= ~(1 << PG_referenced);
+		page->age = PAGE_AGE_INITIAL;
 		free_pages_ok(page - mem_map, order, PageDMA(page) ? 1 : 0);
 		return;
 	}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

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

end of thread, other threads:[~2000-07-09 15:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-08  9:16 [PATCH] page aging for 2.2.16 Neil Schemenauer
2000-06-08 12:41 ` Matthias Andree
2000-06-08 14:00   ` Stephen C. Tweedie
2000-07-09 15:30 ` Ed Tomlinson

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