summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-07-27 03:24:10 +0000
committerdyson <dyson@FreeBSD.org>1996-07-27 03:24:10 +0000
commit293abd3564090ccf9196bbd4bc949163b91fce62 (patch)
treee65b39cf45164a5e0f930222b2d2e90148f2f518 /sys/vm/vm_pageout.c
parent5306d9c9d6bc06b09eb3c7ca700475faafbee5c1 (diff)
downloadFreeBSD-src-293abd3564090ccf9196bbd4bc949163b91fce62.zip
FreeBSD-src-293abd3564090ccf9196bbd4bc949163b91fce62.tar.gz
This commit is meant to solve a couple of VM system problems or
performance issues. 1) The pmap module has had too many inlines, and so the object file is simply bigger than it needs to be. Some common code is also merged into subroutines. 2) Removal of some *evil* PHYS_TO_VM_PAGE macro calls. Unfortunately, a few have needed to be added also. The removal caused the need for more vm_page_lookups. I added lookup hints to minimize the need for the page table lookup operations. 3) Removal of some bogus performance improvements, that mostly made the code more complex (tracking individual page table page updates unnecessarily). Those improvements actually hurt 386 processors perf (not that people who worry about perf use 386 processors anymore :-)). 4) Changed pv queue manipulations/structures to be TAILQ's. 5) The pv queue code has had some performance problems since day one. Some significant scalability issues are resolved by threading the pv entries from the pmap AND the physical address instead of just the physical address. This makes certain pmap operations run much faster. This does not affect most micro-benchmarks, but should help loaded system performance *significantly*. DG helped and came up with most of the solution for this one. 6) Most if not all pmap bit operations follow the pattern: pmap_test_bit(); pmap_clear_bit(); That made for twice the necessary pv list traversal. The pmap interface now supports only pmap_tc_bit type operations: pmap_[test/clear]_modified, pmap_[test/clear]_referenced. Additionally, the modified routine now takes a vm_page_t arg instead of a phys address. This eliminates a PHYS_TO_VM_PAGE operation. 7) Several rewrites of routines that contain redundant code to use common routines, so that there is a greater likelihood of keeping the cache footprint smaller.
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 98ad6ef..26df38c 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -314,12 +314,9 @@ do_backward:
}
}
- /*
- * we allow reads during pageouts...
- */
for (i = page_base; i < (page_base + pageout_count); i++) {
mc[i]->flags |= PG_BUSY;
- vm_page_protect(mc[i], VM_PROT_READ);
+ vm_page_protect(mc[i], VM_PROT_NONE);
}
return vm_pageout_flush(&mc[page_base], pageout_count, sync);
@@ -359,7 +356,7 @@ vm_pageout_flush(mc, count, sync)
* essentially lose the changes by pretending it
* worked.
*/
- pmap_clear_modify(VM_PAGE_TO_PHYS(mt));
+ pmap_tc_modified(mt);
mt->dirty = 0;
break;
case VM_PAGER_ERROR:
@@ -446,7 +443,7 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
continue;
}
- refcount = pmap_ts_referenced(VM_PAGE_TO_PHYS(p));
+ refcount = pmap_tc_referenced(VM_PAGE_TO_PHYS(p));
if (refcount) {
p->flags |= PG_REFERENCED;
} else if (p->flags & PG_REFERENCED) {
@@ -586,7 +583,7 @@ vm_pageout_scan()
maxlaunder = (cnt.v_inactive_target > MAXLAUNDER) ?
MAXLAUNDER : cnt.v_inactive_target;
-rescan0:
+
maxscan = cnt.v_inactive_count;
for( m = TAILQ_FIRST(&vm_page_queue_inactive);
@@ -599,7 +596,7 @@ rescan0:
cnt.v_pdpages++;
if (m->queue != PQ_INACTIVE) {
- goto rescan0;
+ break;
}
next = TAILQ_NEXT(m, pageq);
@@ -621,32 +618,33 @@ rescan0:
continue;
}
- if (m->object->ref_count == 0) {
- m->flags &= ~PG_REFERENCED;
- pmap_clear_reference(VM_PAGE_TO_PHYS(m));
- } else if (((m->flags & PG_REFERENCED) == 0) &&
- pmap_ts_referenced(VM_PAGE_TO_PHYS(m))) {
- vm_page_activate(m);
- continue;
- }
-
- if ((m->flags & PG_REFERENCED) != 0) {
- m->flags &= ~PG_REFERENCED;
- pmap_clear_reference(VM_PAGE_TO_PHYS(m));
- vm_page_activate(m);
- continue;
- }
+ if (m->valid != 0) {
+ if (m->object->ref_count == 0) {
+ m->flags &= ~PG_REFERENCED;
+ pmap_tc_referenced(VM_PAGE_TO_PHYS(m));
+ } else if (((m->flags & PG_REFERENCED) == 0) &&
+ pmap_tc_referenced(VM_PAGE_TO_PHYS(m))) {
+ vm_page_activate(m);
+ continue;
+ }
- if (m->dirty == 0) {
- vm_page_test_dirty(m);
- } else if (m->dirty != 0) {
- m->dirty = VM_PAGE_BITS_ALL;
- }
+ if ((m->flags & PG_REFERENCED) != 0) {
+ m->flags &= ~PG_REFERENCED;
+ pmap_tc_referenced(VM_PAGE_TO_PHYS(m));
+ vm_page_activate(m);
+ continue;
+ }
+ if (m->dirty == 0) {
+ vm_page_test_dirty(m);
+ } else if (m->dirty != 0) {
+ m->dirty = VM_PAGE_BITS_ALL;
+ }
+ }
if (m->valid == 0) {
vm_page_protect(m, VM_PROT_NONE);
vm_page_free(m);
- cnt.v_dfree++;
+ ++cnt.v_dfree;
++pages_freed;
} else if (m->dirty == 0) {
vm_page_cache(m);
@@ -788,7 +786,7 @@ rescan0:
if (m->flags & PG_REFERENCED) {
refcount += 1;
}
- refcount += pmap_ts_referenced(VM_PAGE_TO_PHYS(m));
+ refcount += pmap_tc_referenced(VM_PAGE_TO_PHYS(m));
if (refcount) {
m->act_count += ACT_ADVANCE + refcount;
if (m->act_count > ACT_MAX)
OpenPOWER on IntegriCloud