diff options
-rw-r--r-- | debian/patches/series | 3 | ||||
-rw-r--r-- | debian/patches/vm-cache-policy0001-VM-cache-policy-change.patch (renamed from debian/patches/vm_cache_policy.patch) | 20 | ||||
-rw-r--r-- | debian/patches/vm-cache-policy0002-vm-keep-track-of-clean-pages.patch (renamed from debian/patches/vm_page_cleanq.patch) | 99 | ||||
-rw-r--r-- | debian/patches/vm-cache-policy0003-vm-evict-clean-pages-first.patch | 57 |
4 files changed, 116 insertions, 63 deletions
diff --git a/debian/patches/series b/debian/patches/series index 3393753..fa6ae31 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,6 @@ task-load.patch reorder-ipc_port.patch sysenter0001-yyy-sysenter-prototype.patch +vm-cache-policy0001-VM-cache-policy-change.patch +vm-cache-policy0002-vm-keep-track-of-clean-pages.patch +vm-cache-policy0003-vm-evict-clean-pages-first.patch diff --git a/debian/patches/vm_cache_policy.patch b/debian/patches/vm-cache-policy0001-VM-cache-policy-change.patch index f98b499..dc6e867 100644 --- a/debian/patches/vm_cache_policy.patch +++ b/debian/patches/vm-cache-policy0001-VM-cache-policy-change.patch @@ -1,7 +1,7 @@ -From 316e41125e61cc7c49d601c7f5f3f9757bb867a5 Mon Sep 17 00:00:00 2001 +From 7b75bc7ec43a5897629da30fca43b9060c7b436a Mon Sep 17 00:00:00 2001 From: Richard Braun <rbraun@sceen.net> Date: Wed, 9 Oct 2013 11:51:54 +0200 -Subject: [PATCH gnumach] VM cache policy change +Subject: [PATCH gnumach 1/3] VM cache policy change This patch lets the kernel unconditionnally cache non empty unreferenced objects instead of using a fixed arbitrary limit. As the pageout daemon @@ -32,7 +32,7 @@ knees. 4 files changed, 68 insertions(+), 116 deletions(-) diff --git a/vm/vm_object.c b/vm/vm_object.c -index 582487e..87b98bb 100644 +index 8c6bbab..2384b08 100644 --- a/vm/vm_object.c +++ b/vm/vm_object.c @@ -59,6 +59,11 @@ @@ -251,7 +251,7 @@ index 582487e..87b98bb 100644 * Routine: vm_object_pmap_protect * * Purpose: -@@ -2734,7 +2676,7 @@ void vm_object_page_remove( +@@ -2732,7 +2674,7 @@ void vm_object_page_remove( * It balances vm_object_lookup vs iteration. */ @@ -260,7 +260,7 @@ index 582487e..87b98bb 100644 vm_object_page_remove_lookup++; for (; start < end; start += PAGE_SIZE) { -@@ -2958,7 +2900,7 @@ void vm_object_print( +@@ -2956,7 +2898,7 @@ void vm_object_print( iprintf("Object 0x%X: size=0x%X", (vm_offset_t) object, (vm_offset_t) object->size); @@ -270,7 +270,7 @@ index 582487e..87b98bb 100644 printf(" %d absent pages,", object->absent_count); printf(" %d paging ops\n", object->paging_in_progress); diff --git a/vm/vm_object.h b/vm/vm_object.h -index 5c42f56..94677e5 100644 +index 3bfc67a..fa208aa 100644 --- a/vm/vm_object.h +++ b/vm/vm_object.h @@ -72,7 +72,7 @@ struct vm_object { @@ -302,10 +302,10 @@ index 5c42f56..94677e5 100644 ((object)->paging_in_progress++) diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c -index ecedb57..3bab01e 100644 +index aff823a..c4aba96 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c -@@ -746,7 +746,12 @@ void vm_pageout_scan(void) +@@ -748,7 +748,12 @@ void vm_pageout_scan(void) reclaim_page: vm_page_free(m); vm_page_unlock_queues(); @@ -320,7 +320,7 @@ index ecedb57..3bab01e 100644 } diff --git a/vm/vm_resident.c b/vm/vm_resident.c -index fa02cbc..cb3a466 100644 +index c70fa73..b65b756 100644 --- a/vm/vm_resident.c +++ b/vm/vm_resident.c @@ -523,7 +523,7 @@ void vm_page_insert( @@ -342,5 +342,5 @@ index fa02cbc..cb3a466 100644 if (object->can_persist && (object->ref_count == 0)) vm_object_cached_pages_update(1); -- -2.1.1 +2.1.4 diff --git a/debian/patches/vm_page_cleanq.patch b/debian/patches/vm-cache-policy0002-vm-keep-track-of-clean-pages.patch index 5535d6e..b875aff 100644 --- a/debian/patches/vm_page_cleanq.patch +++ b/debian/patches/vm-cache-policy0002-vm-keep-track-of-clean-pages.patch @@ -1,3 +1,39 @@ +From 0f953bd092eb28c63000cca51bbb0720141d99f9 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 21 Feb 2015 00:05:31 +0100 +Subject: [PATCH gnumach 2/3] vm: keep track of clean pages + +* vm/vm_page.h (struct vm_page): New field `cleanq'. +(vm_page_queue_clean): New declaration. +(vm_page_clean_count): Likewise. +(vm_page_queue_clean_lock): Likewise. +(vm_page_mark_dirty): New function to set and clear the dirty flag. +* vm/vm_resident.c (vm_page_queue_clean): New variable. +(vm_page_queue_clean_lock): Likewise. +(vm_page_clean_count): Likewise. +(vm_page_bootstrap): Initialize field `cleanq', the queue and the lock. +(vm_page_free): Get freed pages off the clean queue. +* linux/dev/glue/block.c: Use `vm_page_mark_dirty'. +* vm/memory_object.c: Likewise. +* vm/vm_debug.c: Likewise. +* vm/vm_fault.c: Likewise. +* vm/vm_map.c: Likewise. +* vm/vm_object.c: Likewise. +* vm/vm_pageout.c: Likewise. +* xen/block.c: Likewise. +--- + linux/dev/glue/block.c | 2 +- + vm/memory_object.c | 4 ++-- + vm/vm_debug.c | 2 +- + vm/vm_fault.c | 6 +++--- + vm/vm_map.c | 2 +- + vm/vm_object.c | 4 ++-- + vm/vm_page.h | 33 +++++++++++++++++++++++++++++++-- + vm/vm_pageout.c | 8 ++++---- + vm/vm_resident.c | 10 ++++++++++ + xen/block.c | 2 +- + 10 files changed, 56 insertions(+), 17 deletions(-) + diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c index da4ef38..3bd2c5b 100644 --- a/linux/dev/glue/block.c @@ -47,7 +83,7 @@ index 227090e..822ca86 100644 vm_page_lock_queues(); diff --git a/vm/vm_fault.c b/vm/vm_fault.c -index 686156c..a48902a 100644 +index 0fa4d6a..4bb6385 100644 --- a/vm/vm_fault.c +++ b/vm/vm_fault.c @@ -978,7 +978,7 @@ vm_fault_return_t vm_fault_page( @@ -91,7 +127,7 @@ index 6b13724..c229df5 100644 if (must_wire) { vm_page_wire(m); diff --git a/vm/vm_object.c b/vm/vm_object.c -index a96516c..f7d8fd2 100644 +index 2384b08..b195303 100644 --- a/vm/vm_object.c +++ b/vm/vm_object.c @@ -587,7 +587,7 @@ void vm_object_terminate( @@ -113,7 +149,7 @@ index a96516c..f7d8fd2 100644 PAGE_WAKEUP_DONE(result_page); diff --git a/vm/vm_page.h b/vm/vm_page.h -index 4fe1b41..729ad8e 100644 +index e6a8c49..41c5711 100644 --- a/vm/vm_page.h +++ b/vm/vm_page.h @@ -70,8 +70,10 @@ @@ -185,7 +221,7 @@ index 4fe1b41..729ad8e 100644 + #endif /* _VM_VM_PAGE_H_ */ diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c -index c4aba96..740a465 100644 +index c4aba96..eb68b20 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c @@ -293,7 +293,7 @@ vm_pageout_setup( @@ -215,45 +251,7 @@ index c4aba96..740a465 100644 assert(!m->precious); PAGE_WAKEUP_DONE(m); } -@@ -681,6 +681,28 @@ void vm_pageout_scan(void) - /*NOTREACHED*/ - } - -+ /* Try to evict a clean page first. */ -+ simple_lock (&vm_page_queue_clean); -+ int tries; -+ for (tries = vm_page_clean_count; tries; tries--) -+ { -+ assert (! queue_empty (&vm_page_queue_clean)); -+ queue_remove_first (&vm_page_queue_clean, -+ m, vm_page_t, cleanq); -+ if (! m->active && m->inactive -+ && (want_pages || m->external)) -+ { -+ m->cleanq.next = NULL; -+ vm_page_clean_count -= 1; -+ simple_unlock (&vm_page_queue_clean); -+ goto got_one; -+ } -+ else -+ queue_enter (&vm_page_queue_clean, -+ m, vm_page_t, cleanq); -+ } -+ simple_unlock (&vm_page_queue_clean); -+ - vm_pageout_inactive++; - - /* Find a page we are interested in paging out. If we -@@ -697,7 +719,7 @@ void vm_pageout_scan(void) - if (!m) - goto pause; - } -- -+ got_one: - object = m->object; - - /* -@@ -780,7 +802,7 @@ void vm_pageout_scan(void) +@@ -780,7 +780,7 @@ void vm_pageout_scan(void) m->busy = TRUE; pmap_page_protect(m->phys_addr, VM_PROT_NONE); if (!m->dirty) @@ -263,7 +261,7 @@ index c4aba96..740a465 100644 if (m->external) { /* Figure out if we still care about this diff --git a/vm/vm_resident.c b/vm/vm_resident.c -index b65b756..2e918da 100644 +index b65b756..46980fc 100644 --- a/vm/vm_resident.c +++ b/vm/vm_resident.c @@ -148,9 +148,12 @@ vm_offset_t vm_page_fictitious_addr = (vm_offset_t) -1; @@ -302,15 +300,7 @@ index b65b756..2e918da 100644 vm_page_free_wanted = 0; -@@ -666,7 +672,6 @@ void vm_page_remove( - bucket->pages = mem->next; - } else { - vm_page_t *prev; -- - for (prev = &this->next; - (this = *prev) != mem; - prev = &this->next) -@@ -1304,6 +1309,10 @@ void vm_page_free( +@@ -1304,6 +1310,10 @@ void vm_page_free( if (mem->absent) vm_object_absent_release(mem->object); @@ -334,3 +324,6 @@ index d98b31e..175955a 100644 vm_page_insert (m, object, o); vm_page_unlock_queues (); o += PAGE_SIZE; +-- +2.1.4 + diff --git a/debian/patches/vm-cache-policy0003-vm-evict-clean-pages-first.patch b/debian/patches/vm-cache-policy0003-vm-evict-clean-pages-first.patch new file mode 100644 index 0000000..f2bf487 --- /dev/null +++ b/debian/patches/vm-cache-policy0003-vm-evict-clean-pages-first.patch @@ -0,0 +1,57 @@ +From c18a562f2b003a893bfb857607ac996ccc5c5be4 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 21 Feb 2015 15:20:46 +0100 +Subject: [PATCH gnumach 3/3] vm: evict clean pages first + +* vm/vm_pageout.c (vm_pageout_scan): Evict clean pages from the list +of clean pages first, without requiring an expensive scan through the +inactive list. +--- + vm/vm_pageout.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c +index eb68b20..740a465 100644 +--- a/vm/vm_pageout.c ++++ b/vm/vm_pageout.c +@@ -681,6 +681,28 @@ void vm_pageout_scan(void) + /*NOTREACHED*/ + } + ++ /* Try to evict a clean page first. */ ++ simple_lock (&vm_page_queue_clean); ++ int tries; ++ for (tries = vm_page_clean_count; tries; tries--) ++ { ++ assert (! queue_empty (&vm_page_queue_clean)); ++ queue_remove_first (&vm_page_queue_clean, ++ m, vm_page_t, cleanq); ++ if (! m->active && m->inactive ++ && (want_pages || m->external)) ++ { ++ m->cleanq.next = NULL; ++ vm_page_clean_count -= 1; ++ simple_unlock (&vm_page_queue_clean); ++ goto got_one; ++ } ++ else ++ queue_enter (&vm_page_queue_clean, ++ m, vm_page_t, cleanq); ++ } ++ simple_unlock (&vm_page_queue_clean); ++ + vm_pageout_inactive++; + + /* Find a page we are interested in paging out. If we +@@ -697,7 +719,7 @@ void vm_pageout_scan(void) + if (!m) + goto pause; + } +- ++ got_one: + object = m->object; + + /* +-- +2.1.4 + |