Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Feb 2009 11:44:03 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189031 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit
Message-ID:  <200902251144.n1PBi3Jp095313@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902251144.n1PBi3Jp095313>