Author: mjg
Date: Thu Nov  6 07:44:10 2014
New Revision: 274166
URL: https://svnweb.freebsd.org/changeset/base/274166

Log:
  filedesc: avoid taking fdesc_mtx when not necessary in fddrop
  
  No functional changes.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Thu Nov  6 07:37:31 2014        
(r274165)
+++ head/sys/kern/kern_descrip.c        Thu Nov  6 07:44:10 2014        
(r274166)
@@ -1859,11 +1859,13 @@ fddrop(struct filedesc *fdp)
 {
        int i;
 
-       mtx_lock(&fdesc_mtx);
-       i = --fdp->fd_holdcnt;
-       mtx_unlock(&fdesc_mtx);
-       if (i > 0)
-               return;
+       if (fdp->fd_holdcnt > 1) {
+               mtx_lock(&fdesc_mtx);
+               i = --fdp->fd_holdcnt;
+               mtx_unlock(&fdesc_mtx);
+               if (i > 0)
+                       return;
+       }
 
        FILEDESC_LOCK_DESTROY(fdp);
        uma_zfree(filedesc0_zone, fdp);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to