page aging for 2.2.16
PATCH 1/1 page aging for 2.2.16
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
Signature · 91 lines
"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 [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/Quoted 1 line · * Neil Schemenauer ([email protected]) [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 [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Hi,
Quoted 5 lines · Matthias Andree
Quoted 1 line · * Neil Schemenauer ([email protected]) [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 [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Quoted 9 lines · Neil Schemenauer
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 <[email protected]>
http://www.cam.org/~tomlins/njpipes.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/