aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2015-06-14 20:23:41 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2015-06-14 20:23:41 +0000
commit776f729c86a929eb3543bbcc8bc02e708fbff113 (patch)
treeb1e01d08d1973619e2f3881c443463f90448a493 /sys/vm
parentb96e9390dbf8f67aab499c9d3928d2af0a1cc672 (diff)
downloadsrc-776f729c86a929eb3543bbcc8bc02e708fbff113.tar.gz
src-776f729c86a929eb3543bbcc8bc02e708fbff113.zip
Invalid pages do not need neither update of the activation count nor
they coould be dirty. Move the handling if the invalid pages in the inactive scan earlier. Remove some code duplication in the scan by introducing the 'drop_page' label, which centralizes the object and the page unlock. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=284387
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_pageout.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 6bfd50ca0f5f..bd77500ecbed 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1159,6 +1159,17 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
queues_locked = FALSE;
/*
+ * Invalid pages can be easily freed. They cannot be
+ * mapped, vm_page_free() asserts this.
+ */
+ if (m->valid == 0 && m->hold_count == 0) {
+ vm_page_free(m);
+ PCPU_INC(cnt.v_dfree);
+ --page_shortage;
+ goto drop_page;
+ }
+
+ /*
* We bump the activation count if the page has been
* referenced while in the inactive queue. This makes
* it less likely that the page will be added back to the
@@ -1192,15 +1203,10 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
queues_locked = TRUE;
vm_page_requeue_locked(m);
}
- VM_OBJECT_WUNLOCK(object);
- vm_page_unlock(m);
- goto relock_queues;
+ goto drop_page;
}
if (m->hold_count != 0) {
- vm_page_unlock(m);
- VM_OBJECT_WUNLOCK(object);
-
/*
* Held pages are essentially stuck in the
* queue. So, they ought to be discounted
@@ -1209,7 +1215,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
* loop over the active queue below.
*/
addl_page_shortage++;
- goto relock_queues;
+ goto drop_page;
}
/*
@@ -1224,14 +1230,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
if (m->dirty == 0 && object->ref_count != 0)
pmap_remove_all(m);
- if (m->valid == 0) {
- /*
- * Invalid pages can be easily freed
- */
- vm_page_free(m);
- PCPU_INC(cnt.v_dfree);
- --page_shortage;
- } else if (m->dirty == 0) {
+ if (m->dirty == 0) {
/*
* Clean pages can be freed.
*/
@@ -1305,6 +1304,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
vm_page_lock_assert(m, MA_NOTOWNED);
goto relock_queues;
}
+drop_page:
vm_page_unlock(m);
VM_OBJECT_WUNLOCK(object);
relock_queues: