summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-02-22 13:24:39 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-02-22 13:24:39 +0100
commit20d03c945d16f2df6e59716d81ea0639b721f1c8 (patch)
treeaa8d874142f58c001b739e789d8f3a5566d75680 /debian
parent28264cc3eecd0c8999b957fba03d8ab6757d9cea (diff)
add vm_page_cleanq.patch
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/0001-xxx-notes.patch39
-rw-r--r--debian/patches/0002-xxx-vm_page_queue_clean.patch113
-rw-r--r--debian/patches/series4
-rw-r--r--debian/patches/vm_page_cleanq.patch (renamed from debian/patches/0003-xxx-vm_page_queue_clean.patch)175
4 files changed, 115 insertions, 216 deletions
diff --git a/debian/patches/0001-xxx-notes.patch b/debian/patches/0001-xxx-notes.patch
deleted file mode 100644
index c4e3679..0000000
--- a/debian/patches/0001-xxx-notes.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 2262aec645a8bb431a6acf76624fd01468ca0715 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 1/3] xxx notes
-
----
- vm/vm_pageout.c | 2 ++
- vm/vm_resident.c | 2 +-
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
-index c4aba96..cee37ce 100644
---- a/vm/vm_pageout.c
-+++ b/vm/vm_pageout.c
-@@ -681,6 +681,8 @@ void vm_pageout_scan(void)
- /*NOTREACHED*/
- }
-
-+ // xxx try to drop a clean page here
-+
- vm_pageout_inactive++;
-
- /* Find a page we are interested in paging out. If we
-diff --git a/vm/vm_resident.c b/vm/vm_resident.c
-index b65b756..92b2397 100644
---- a/vm/vm_resident.c
-+++ b/vm/vm_resident.c
-@@ -666,7 +666,7 @@ void vm_page_remove(
- bucket->pages = mem->next;
- } else {
- vm_page_t *prev;
--
-+ // XXX linear scan
- for (prev = &this->next;
- (this = *prev) != mem;
- prev = &this->next)
---
-2.1.4
-
diff --git a/debian/patches/0002-xxx-vm_page_queue_clean.patch b/debian/patches/0002-xxx-vm_page_queue_clean.patch
deleted file mode 100644
index 857a675..0000000
--- a/debian/patches/0002-xxx-vm_page_queue_clean.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From c3f9932330e1803d9c7373ca3db69557b716f359 Mon Sep 17 00:00:00 2001
-From: Justus Winter <4winter@informatik.uni-hamburg.de>
-Date: Sat, 21 Feb 2015 00:54:05 +0100
-Subject: [PATCH gnumach 2/3] xxx vm_page_queue_clean
-
----
- vm/vm_page.h | 27 +++++++++++++++++++++++++--
- vm/vm_resident.c | 5 +++++
- 2 files changed, 30 insertions(+), 2 deletions(-)
-
-diff --git a/vm/vm_page.h b/vm/vm_page.h
-index 4fe1b41..6d2dbd9 100644
---- a/vm/vm_page.h
-+++ b/vm/vm_page.h
-@@ -70,8 +70,10 @@
- * and sundry status bits.
- *
- * Fields in this structure are locked either by the lock on the
-- * object that the page belongs to (O) or by the lock on the page
-- * queues (P). [Some fields require that both locks be held to
-+ * object that the page belongs to (O), by the lock on the page
-+ * queues (P), or by vm_page_queue_clean_lock (C).
-+ *
-+ * [Some fields require that both locks, O and P, be held to
- * change that field; holding either lock is sufficient to read.]
- */
-
-@@ -79,6 +81,7 @@ struct vm_page {
- queue_chain_t pageq; /* queue info for FIFO
- * queue or free list (P) */
- queue_chain_t listq; /* all pages in same object (O) */
-+ queue_chain_t cleanq; /* all clean pages (C) */
- struct vm_page *next; /* VP bucket link (O) */
-
- vm_object_t object; /* which object am I in (O,P) */
-@@ -147,6 +150,8 @@ extern
- queue_head_t vm_page_queue_active; /* active memory queue */
- extern
- queue_head_t vm_page_queue_inactive; /* inactive memory queue */
-+extern
-+queue_head_t vm_page_queue_clean; /* clean memory queue */
-
- extern
- int vm_page_free_count; /* How many pages are free? */
-@@ -184,6 +189,8 @@ decl_simple_lock_data(extern,vm_page_queue_lock)/* lock on active and inactive
- page queues */
- decl_simple_lock_data(extern,vm_page_queue_free_lock)
- /* lock on free page queue */
-+decl_simple_lock_data(extern,vm_page_queue_clean_lock)
-+ /* lock on clean page queue */
-
- extern unsigned int vm_page_free_wanted;
- /* how many threads are waiting for memory */
-@@ -312,4 +319,20 @@ extern unsigned int vm_page_info(
- } \
- MACRO_END
-
-+static inline void
-+vm_page_mark_dirty (vm_page_t m, boolean_t dirty)
-+{
-+ if (m->dirty == dirty)
-+ return;
-+
-+ simple_lock (&vm_page_queue_clean_lock);
-+ if (dirty && m->cleanq.next) {
-+ queue_remove (&vm_page_queue_clean, m, vm_page_t, cleanq);
-+ m->cleanq.next = NULL;
-+ }
-+ if (! dirty)
-+ queue_enter (&vm_page_queue_clean, m, vm_page_t, cleanq);
-+ simple_unlock (&vm_page_queue_clean_lock);
-+}
-+
- #endif /* _VM_VM_PAGE_H_ */
-diff --git a/vm/vm_resident.c b/vm/vm_resident.c
-index 92b2397..49ef148 100644
---- a/vm/vm_resident.c
-+++ b/vm/vm_resident.c
-@@ -148,6 +148,8 @@ vm_offset_t vm_page_fictitious_addr = (vm_offset_t) -1;
- queue_head_t vm_page_queue_active;
- queue_head_t vm_page_queue_inactive;
- decl_simple_lock_data(,vm_page_queue_lock)
-+queue_head_t vm_page_queue_clean;
-+decl_simple_lock_data(,vm_page_queue_clean_lock)
- int vm_page_active_count;
- int vm_page_inactive_count;
- int vm_page_wire_count;
-@@ -200,6 +202,7 @@ void vm_page_bootstrap(
- */
-
- m = &vm_page_template;
-+ m->cleanq.next = NULL;
- m->object = VM_OBJECT_NULL; /* reset later */
- m->offset = 0; /* reset later */
- m->wire_count = 0;
-@@ -231,12 +234,14 @@ void vm_page_bootstrap(
- */
-
- simple_lock_init(&vm_page_queue_free_lock);
-+ simple_lock_init(&vm_page_queue_clean_lock);
- simple_lock_init(&vm_page_queue_lock);
-
- vm_page_queue_free = VM_PAGE_NULL;
- vm_page_queue_fictitious = VM_PAGE_NULL;
- queue_init(&vm_page_queue_active);
- queue_init(&vm_page_queue_inactive);
-+ queue_init(&vm_page_queue_clean);
-
- vm_page_free_wanted = 0;
-
---
-2.1.4
-
diff --git a/debian/patches/series b/debian/patches/series
index db4f173..530b368 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,7 +6,5 @@
Add-some-padding-to-make-objects-fit-a-single-cache-.patch
vm_cache_policy.patch
+vm_page_cleanq.patch
task-load.patch
-0001-xxx-notes.patch
-0002-xxx-vm_page_queue_clean.patch
-0003-xxx-vm_page_queue_clean.patch
diff --git a/debian/patches/0003-xxx-vm_page_queue_clean.patch b/debian/patches/vm_page_cleanq.patch
index 7ede5bc..5535d6e 100644
--- a/debian/patches/0003-xxx-vm_page_queue_clean.patch
+++ b/debian/patches/vm_page_cleanq.patch
@@ -1,21 +1,3 @@
-From 6c0e9705027efc58e24a038566ef07388069a340 Mon Sep 17 00:00:00 2001
-From: Justus Winter <4winter@informatik.uni-hamburg.de>
-Date: Sat, 21 Feb 2015 01:13:16 +0100
-Subject: [PATCH gnumach 3/3] xxx vm_page_queue_clean
-
----
- 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 | 12 +++++++++---
- vm/vm_pageout.c | 28 ++++++++++++++++++++++------
- vm/vm_resident.c | 5 +++++
- xen/block.c | 2 +-
- 10 files changed, 47 insertions(+), 20 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
@@ -131,11 +113,36 @@ index a96516c..f7d8fd2 100644
PAGE_WAKEUP_DONE(result_page);
diff --git a/vm/vm_page.h b/vm/vm_page.h
-index 6d2dbd9..729ad8e 100644
+index 4fe1b41..729ad8e 100644
--- a/vm/vm_page.h
+++ b/vm/vm_page.h
-@@ -154,6 +154,8 @@ extern
- queue_head_t vm_page_queue_clean; /* clean memory queue */
+@@ -70,8 +70,10 @@
+ * and sundry status bits.
+ *
+ * Fields in this structure are locked either by the lock on the
+- * object that the page belongs to (O) or by the lock on the page
+- * queues (P). [Some fields require that both locks be held to
++ * object that the page belongs to (O), by the lock on the page
++ * queues (P), or by vm_page_queue_clean_lock (C).
++ *
++ * [Some fields require that both locks, O and P, be held to
+ * change that field; holding either lock is sufficient to read.]
+ */
+
+@@ -79,6 +81,7 @@ struct vm_page {
+ queue_chain_t pageq; /* queue info for FIFO
+ * queue or free list (P) */
+ queue_chain_t listq; /* all pages in same object (O) */
++ queue_chain_t cleanq; /* all clean pages (C) */
+ struct vm_page *next; /* VP bucket link (O) */
+
+ vm_object_t object; /* which object am I in (O,P) */
+@@ -147,8 +150,12 @@ extern
+ queue_head_t vm_page_queue_active; /* active memory queue */
+ extern
+ queue_head_t vm_page_queue_inactive; /* inactive memory queue */
++extern
++queue_head_t vm_page_queue_clean; /* clean memory queue */
extern
+int vm_page_clean_count; /* How many pages are clean? */
@@ -143,33 +150,42 @@ index 6d2dbd9..729ad8e 100644
int vm_page_free_count; /* How many pages are free? */
extern
int vm_page_fictitious_count;/* How many fictitious pages are free? */
-@@ -322,17 +324,21 @@ extern unsigned int vm_page_info(
- static inline void
- vm_page_mark_dirty (vm_page_t m, boolean_t dirty)
- {
-- if (m->dirty == dirty)
-- return;
+@@ -184,6 +191,8 @@ decl_simple_lock_data(extern,vm_page_queue_lock)/* lock on active and inactive
+ page queues */
+ decl_simple_lock_data(extern,vm_page_queue_free_lock)
+ /* lock on free page queue */
++decl_simple_lock_data(extern,vm_page_queue_clean_lock)
++ /* lock on clean page queue */
+
+ extern unsigned int vm_page_free_wanted;
+ /* how many threads are waiting for memory */
+@@ -312,4 +321,24 @@ extern unsigned int vm_page_info(
+ } \
+ MACRO_END
+
++static inline void
++vm_page_mark_dirty (vm_page_t m, boolean_t dirty)
++{
+ if (m->dirty == dirty && (dirty || m->cleanq.next))
+ return; /* No action necessary. */
-
- simple_lock (&vm_page_queue_clean_lock);
- if (dirty && m->cleanq.next) {
- queue_remove (&vm_page_queue_clean, m, vm_page_t, cleanq);
++
++ simple_lock (&vm_page_queue_clean_lock);
++ if (dirty && m->cleanq.next) {
++ queue_remove (&vm_page_queue_clean, m, vm_page_t, cleanq);
+ vm_page_clean_count -= 1;
- m->cleanq.next = NULL;
- }
-- if (! dirty)
++ m->cleanq.next = NULL;
++ }
+ if (! dirty) {
- queue_enter (&vm_page_queue_clean, m, vm_page_t, cleanq);
++ queue_enter (&vm_page_queue_clean, m, vm_page_t, cleanq);
+ vm_page_clean_count += 1;
+ }
- simple_unlock (&vm_page_queue_clean_lock);
++ simple_unlock (&vm_page_queue_clean_lock);
+ m->dirty = dirty;
- }
-
++}
++
#endif /* _VM_VM_PAGE_H_ */
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
-index cee37ce..80a2f1b 100644
+index c4aba96..740a465 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -293,7 +293,7 @@ vm_pageout_setup(
@@ -199,32 +215,36 @@ index cee37ce..80a2f1b 100644
assert(!m->precious);
PAGE_WAKEUP_DONE(m);
}
-@@ -681,7 +681,23 @@ void vm_pageout_scan(void)
+@@ -681,6 +681,28 @@ void vm_pageout_scan(void)
/*NOTREACHED*/
}
-- // xxx try to drop a clean page here
-+ //printf ("trying to evict page from clean list (%d pages clean)\n", vm_page_clean_count);
+ /* Try to evict a clean page first. */
+ simple_lock (&vm_page_queue_clean);
-+ while (! queue_empty (&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);
-+ }
++ && (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++;
-@@ -699,7 +715,7 @@ void vm_pageout_scan(void)
+ /* Find a page we are interested in paging out. If we
+@@ -697,7 +719,7 @@ void vm_pageout_scan(void)
if (!m)
goto pause;
}
@@ -233,7 +253,7 @@ index cee37ce..80a2f1b 100644
object = m->object;
/*
-@@ -782,7 +798,7 @@ void vm_pageout_scan(void)
+@@ -780,7 +802,7 @@ void vm_pageout_scan(void)
m->busy = TRUE;
pmap_page_protect(m->phys_addr, VM_PROT_NONE);
if (!m->dirty)
@@ -243,10 +263,15 @@ index cee37ce..80a2f1b 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 49ef148..0e490b5 100644
+index b65b756..2e918da 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
-@@ -153,6 +153,7 @@ decl_simple_lock_data(,vm_page_queue_clean_lock)
+@@ -148,9 +148,12 @@ vm_offset_t vm_page_fictitious_addr = (vm_offset_t) -1;
+ queue_head_t vm_page_queue_active;
+ queue_head_t vm_page_queue_inactive;
+ decl_simple_lock_data(,vm_page_queue_lock)
++queue_head_t vm_page_queue_clean;
++decl_simple_lock_data(,vm_page_queue_clean_lock)
int vm_page_active_count;
int vm_page_inactive_count;
int vm_page_wire_count;
@@ -254,7 +279,38 @@ index 49ef148..0e490b5 100644
/*
* Several page replacement parameters are also
-@@ -1309,6 +1310,10 @@ void vm_page_free(
+@@ -200,6 +203,7 @@ void vm_page_bootstrap(
+ */
+
+ m = &vm_page_template;
++ m->cleanq.next = NULL;
+ m->object = VM_OBJECT_NULL; /* reset later */
+ m->offset = 0; /* reset later */
+ m->wire_count = 0;
+@@ -231,12 +235,14 @@ void vm_page_bootstrap(
+ */
+
+ simple_lock_init(&vm_page_queue_free_lock);
++ simple_lock_init(&vm_page_queue_clean_lock);
+ simple_lock_init(&vm_page_queue_lock);
+
+ vm_page_queue_free = VM_PAGE_NULL;
+ vm_page_queue_fictitious = VM_PAGE_NULL;
+ queue_init(&vm_page_queue_active);
+ queue_init(&vm_page_queue_inactive);
++ queue_init(&vm_page_queue_clean);
+
+ 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(
if (mem->absent)
vm_object_absent_release(mem->object);
@@ -278,6 +334,3 @@ index d98b31e..175955a 100644
vm_page_insert (m, object, o);
vm_page_unlock_queues ();
o += PAGE_SIZE;
---
-2.1.4
-