summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-05-06 21:04:42 +0000
committerkib <kib@FreeBSD.org>2013-05-06 21:04:42 +0000
commit37807bfa8afb3c3c32bb497a61a024216fdc4287 (patch)
treed8cecac6fd9d09fe7f03cefb768e019315dbdc4a /sys/fs
parent7608fe34250103a7b9545d34936ae6ec135eb9d1 (diff)
downloadFreeBSD-src-37807bfa8afb3c3c32bb497a61a024216fdc4287.zip
FreeBSD-src-37807bfa8afb3c3c32bb497a61a024216fdc4287.tar.gz
Avoid deactivating the page if it is already on a queue, only requeue
the page. This both reduces the number of queues locking and avoids moving the active page to inactive list just because the page was read or written. Based on the suggestion by: alc Reviewed by: alc Tested by: pho
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 53f4882..cb27854 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -493,10 +493,12 @@ tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx,
VM_OBJECT_WLOCK(tobj);
vm_page_lock(m);
vm_page_unhold(m);
- vm_page_deactivate(m);
- /* Requeue to maintain LRU ordering. */
- if (m->queue != PQ_NONE)
+ if (m->queue == PQ_NONE) {
+ vm_page_deactivate(m);
+ } else {
+ /* Requeue to maintain LRU ordering. */
vm_page_requeue(m);
+ }
vm_page_unlock(m);
VM_OBJECT_WUNLOCK(tobj);
@@ -609,10 +611,12 @@ tmpfs_mappedwrite(vm_object_t tobj, size_t len, struct uio *uio)
vm_page_dirty(tpg);
vm_page_lock(tpg);
vm_page_unhold(tpg);
- vm_page_deactivate(tpg);
- /* Requeue to maintain LRU ordering. */
- if (tpg->queue != PQ_NONE)
+ if (tpg->queue == PQ_NONE) {
+ vm_page_deactivate(tpg);
+ } else {
+ /* Requeue to maintain LRU ordering. */
vm_page_requeue(tpg);
+ }
vm_page_unlock(tpg);
VM_OBJECT_WUNLOCK(tobj);
OpenPOWER on IntegriCloud