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

* Re: [PATCH] page aging for 2.2.16
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Matthias Andree @ 2000-06-08 12:41 UTC (permalink / raw)
  To: Neil Schemenauer, linux-mm, linux-kernel

* Neil Schemenauer (nascheme@enme.ucalgary.ca) [000608 11:21]:
> I timed a kernel compile with -j 20 to test the cost of the

you mean: make -j 2 MAKE="make -j 10"? Recursive make easily breaks its
-j option if -j is given a numeric parameter.

Will try your patch later. 
--
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

* Re: [PATCH] page aging for 2.2.16
  2000-06-08 12:41 ` Matthias Andree
@ 2000-06-08 14:00   ` Stephen C. Tweedie
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen C. Tweedie @ 2000-06-08 14:00 UTC (permalink / raw)
  To: Matthias Andree, Neil Schemenauer, linux-mm, linux-kernel; +Cc: Stephen Tweedie

Hi,

On Thu, Jun 08, 2000 at 02:41:26PM +0200, Matthias Andree wrote:
> * Neil Schemenauer (nascheme@enme.ucalgary.ca) [000608 11:21]:
> > I timed a kernel compile with -j 20 to test the cost of the
> 
> you mean: make -j 2 MAKE="make -j 10"? Recursive make easily breaks its
> -j option if -j is given a numeric parameter.

On modern versions of Gnu Make, "-j <n>" uses a "jobserver" facility to make
sure that the parent and all child make processes share the same pool of
up to <n> compilation tasks.  It handles recursion properly nowadays.

Cheers,
 Stephen
--
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

* Re: [PATCH] page aging for 2.2.16
  2000-06-08  9:16 [PATCH] page aging for 2.2.16 Neil Schemenauer
  2000-06-08 12:41 ` Matthias Andree
@ 2000-07-09 15:30 ` Ed Tomlinson
  1 sibling, 0 replies; 4+ messages in thread
From: Ed Tomlinson @ 2000-07-09 15:30 UTC (permalink / raw)
  To: Neil Schemenauer; +Cc: linux-mm

On Thu, 08 Jun 2000, Neil Schemenauer wrote:
> 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.

I have been running with with 2.2.17pre5 + this patch for the last
12 days with very good results.  The reiserfs guys fixed a block
leak under high load and released 3.5.23.  I want to rebuild my 
kernel.  I was thinking of 2.2.17pre10 + Marcelo Tosatti's merged 
patch which includes

- balance dirty patch which wakes up kflushd at "correct" times. (Andrea)
- GFP-race-fix-2.patch, fixes the free_before_allocate issue without
  hurting other cases. (Andrea)
- wait-dirty.patch, to avoid processes from waiting at dirty buffers while
  there is freeable cache around. (me)
- WRITEA patch, fixes the interactiveness problem under high IO. (me)

along with the page aging stuff.  

Is there a better combo?  
                                                                                  
Ed Tomlinson <tomlins@cam.org>
http://www.cam.org/~tomlins/njpipes.html
--
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