diff options
author | jeff <jeff@FreeBSD.org> | 2013-08-21 22:39:19 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2013-08-21 22:39:19 +0000 |
commit | bef38f5afd547a1595d017e79820aa9d3fe41282 (patch) | |
tree | e95422f5dc23c807ed576d77da5d87c205011f63 /sys/vm | |
parent | 96dfe577d25fd7efedf4ae97d4a81f81ae7fd1c8 (diff) | |
download | FreeBSD-src-bef38f5afd547a1595d017e79820aa9d3fe41282.zip FreeBSD-src-bef38f5afd547a1595d017e79820aa9d3fe41282.tar.gz |
- Eliminate the vm object lock from the active queue scan. It is not
necessary since we do not free or cache the page from active anymore.
Document the one possible race that is harmless.
Sponsored by: EMC / Isilon Storage Division
Discussed with: alc
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_pageout.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 472ae78..5660b56 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1333,25 +1333,6 @@ relock_queues: m = next; continue; } - object = m->object; - if (!VM_OBJECT_TRYWLOCK(object) && - !vm_pageout_fallback_object_lock(m, &next)) { - VM_OBJECT_WUNLOCK(object); - vm_page_unlock(m); - m = next; - continue; - } - - /* - * Don't deactivate pages that are busy. - */ - if (vm_page_busied(m) || m->hold_count != 0) { - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); - vm_page_requeue_locked(m); - m = next; - continue; - } /* * The count for pagedaemon pages is done after checking the @@ -1367,7 +1348,15 @@ relock_queues: vm_page_aflag_clear(m, PGA_REFERENCED); act_delta += 1; } - if (object->ref_count != 0) + /* + * Unlocked object ref count check. Two races are possible. + * 1) The ref was transitioning to zero and we saw non-zero, + * the pmap bits will be checked unnecessarily. + * 2) The ref was transitioning to one and we saw zero. + * The page lock prevents a new reference to this page so + * we need not check the reference bits. + */ + if (m->object->ref_count != 0) act_delta += pmap_ts_referenced(m); /* @@ -1387,9 +1376,6 @@ relock_queues: * queue depending on usage. */ if (act_delta == 0) { - KASSERT(object->ref_count != 0 || - !pmap_page_is_mapped(m), - ("vm_pageout_scan: page %p is mapped", m)); /* Dequeue to avoid later lock recursion. */ vm_page_dequeue_locked(m); vm_page_deactivate(m); @@ -1397,7 +1383,6 @@ relock_queues: } else vm_page_requeue_locked(m); vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); m = next; } vm_pagequeue_unlock(pq); |