summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2010-06-14 19:54:19 +0000
committeralc <alc@FreeBSD.org>2010-06-14 19:54:19 +0000
commitddca4dfc3b2c761cdb185d343021802c29c72eec (patch)
treee5acd3bb1996c1a25a477cc3c2825d2943bc41ef /sys/vm/vm_pageout.c
parentf702a7e6bc7382df6f5db644e1f21d49284c87af (diff)
downloadFreeBSD-src-ddca4dfc3b2c761cdb185d343021802c29c72eec.zip
FreeBSD-src-ddca4dfc3b2c761cdb185d343021802c29c72eec.tar.gz
Eliminate checks for a page having a NULL object in vm_pageout_scan()
and vm_pageout_page_stats(). These checks were recently introduced by the first page locking commit, r207410, but they are not needed. At the same time, eliminate some redundant accesses to the page's object field. (These accesses should have neen eliminated by r207410.) Make the assertion in vm_page_flag_set() stricter. Specifically, only managed pages should have PG_WRITEABLE set. Add a comment documenting an assertion to vm_page_flag_clear(). It has long been the case that fictitious pages have their wire count permanently set to one. Add comments to vm_page_wire() and vm_page_unwire() documenting this. Add assertions to these functions as well. Update the comment describing vm_page_unwire(). Much of the old comment had little to do with vm_page_unwire(), but a lot to do with _vm_page_deactivate(). Move relevant parts of the old comment to _vm_page_deactivate(). Only pages that belong to an object can be paged out. Therefore, it is pointless for vm_page_unwire() to acquire the page queues lock and enqueue such pages in one of the paging queues. Generally speaking, such pages are immediately freed after the call to vm_page_unwire(). Previously, it was the call to vm_page_free() that reacquired the page queues lock and removed these pages from the paging queues. Now, we will never acquire the page queues lock for this case. (It is also worth noting that since both vm_page_unwire() and vm_page_free() occurred with the page locked, the page daemon never saw the page with its object field set to NULL.) Change the panic with vm_page_unwire() to provide a more precise message. Reviewed by: kib@
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index bff803d..62163de 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -805,7 +805,7 @@ rescan0:
/*
* A held page may be undergoing I/O, so skip it.
*/
- if (m->hold_count || (object = m->object) == NULL) {
+ if (m->hold_count) {
vm_page_unlock(m);
vm_page_requeue(m);
addl_page_shortage++;
@@ -816,6 +816,7 @@ rescan0:
* Don't mess with busy pages, keep in the front of the
* queue, most likely are being paged out.
*/
+ object = m->object;
if (!VM_OBJECT_TRYLOCK(object) &&
(!vm_pageout_fallback_object_lock(m, &next) ||
m->hold_count != 0)) {
@@ -1127,17 +1128,16 @@ unlock_and_continue:
("vm_pageout_scan: page %p isn't active", m));
next = TAILQ_NEXT(m, pageq);
- object = m->object;
if ((m->flags & PG_MARKER) != 0) {
m = next;
continue;
}
- if (!vm_pageout_page_lock(m, &next) ||
- (object = m->object) == NULL) {
+ if (!vm_pageout_page_lock(m, &next)) {
vm_page_unlock(m);
m = next;
continue;
}
+ object = m->object;
if (!VM_OBJECT_TRYLOCK(object) &&
!vm_pageout_fallback_object_lock(m, &next)) {
VM_OBJECT_UNLOCK(object);
@@ -1397,12 +1397,12 @@ vm_pageout_page_stats()
continue;
}
vm_page_lock_assert(m, MA_NOTOWNED);
- if (!vm_pageout_page_lock(m, &next) ||
- (object = m->object) == NULL) {
+ if (!vm_pageout_page_lock(m, &next)) {
vm_page_unlock(m);
m = next;
continue;
}
+ object = m->object;
if (!VM_OBJECT_TRYLOCK(object) &&
!vm_pageout_fallback_object_lock(m, &next)) {
VM_OBJECT_UNLOCK(object);
OpenPOWER on IntegriCloud