Author: alc
Date: Tue Aug 25 01:01:25 2015
New Revision: 287121
URL: https://svnweb.freebsd.org/changeset/base/287121

Log:
  Testing whether a page is dirty does not require the page lock.  Moreover,
  it may involve a pmap operation that iterates over the page's PV list, so
  unnecessarily holding the page lock is undesirable.
  
  MFC after:    1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c    Mon Aug 24 23:40:36 2015        (r287120)
+++ head/sys/vm/vm_pageout.c    Tue Aug 25 01:01:25 2015        (r287121)
@@ -415,10 +415,13 @@ more:
                        ib = 0;
                        break;
                }
-               vm_page_lock(p);
                vm_page_test_dirty(p);
-               if (p->dirty == 0 ||
-                   p->queue != PQ_INACTIVE ||
+               if (p->dirty == 0) {
+                       ib = 0;
+                       break;
+               }
+               vm_page_lock(p);
+               if (p->queue != PQ_INACTIVE ||
                    p->hold_count != 0) {       /* may be undergoing I/O */
                        vm_page_unlock(p);
                        ib = 0;
@@ -442,10 +445,11 @@ more:
 
                if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p))
                        break;
-               vm_page_lock(p);
                vm_page_test_dirty(p);
-               if (p->dirty == 0 ||
-                   p->queue != PQ_INACTIVE ||
+               if (p->dirty == 0)
+                       break;
+               vm_page_lock(p);
+               if (p->queue != PQ_INACTIVE ||
                    p->hold_count != 0) {       /* may be undergoing I/O */
                        vm_page_unlock(p);
                        break;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to