Author: rwatson
Date: Wed Feb 25 11:44:03 2009
New Revision: 189031
URL: http://svn.freebsd.org/changeset/base/189031

Log:
  Merge r186825 from head to stable/7:
  
    Do a lockless read of the audit pipe list before grabbing the audit pipe
    lock in order to avoid the lock acquire hit if the pipe list is very
    likely empty.
  
    Obtained from:        TrustedBSD Project
    Sponsored by: Apple, Inc.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/security/audit/audit_pipe.c

Modified: stable/7/sys/security/audit/audit_pipe.c
==============================================================================
--- stable/7/sys/security/audit/audit_pipe.c    Wed Feb 25 11:37:19 2009        
(r189030)
+++ stable/7/sys/security/audit/audit_pipe.c    Wed Feb 25 11:44:03 2009        
(r189031)
@@ -407,6 +407,10 @@ audit_pipe_preselect(au_id_t auid, au_ev
 {
        struct audit_pipe *ap;
 
+       /* Lockless read to avoid acquiring the global lock if not needed. */
+       if (TAILQ_EMPTY(&audit_pipe_list))
+               return (0);
+
        AUDIT_PIPE_LIST_RLOCK();
        TAILQ_FOREACH(ap, &audit_pipe_list, ap_list) {
                AUDIT_PIPE_LOCK(ap);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to