From owner-svn-src-stable-7@FreeBSD.ORG Wed Feb 25 11:44:03 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A077F1065670; Wed, 25 Feb 2009 11:44:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CD3A8FC14; Wed, 25 Feb 2009 11:44:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1PBi32D095314; Wed, 25 Feb 2009 11:44:03 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1PBi3Jp095313; Wed, 25 Feb 2009 11:44:03 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200902251144.n1PBi3Jp095313@svn.freebsd.org> From: Robert Watson Date: Wed, 25 Feb 2009 11:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189031 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb security/audit X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2009 11:44:04 -0000 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);