svn commit: r250310 - head/sys/fs/tmpfs

Konstantin Belousov kib at FreeBSD.org
Mon May 6 21:04:42 UTC 2013


Author: kib
Date: Mon May  6 21:04:42 2013
New Revision: 250310
URL: http://svnweb.freebsd.org/changeset/base/250310

Log:
  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

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Mon May  6 20:58:02 2013	(r250309)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Mon May  6 21:04:42 2013	(r250310)
@@ -493,10 +493,12 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p
 	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
 		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);
 


More information about the svn-src-all mailing list