From owner-svn-src-all@freebsd.org Wed Dec 19 22:30:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EA51134B254; Wed, 19 Dec 2018 22:30:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36C1672EDE; Wed, 19 Dec 2018 22:30:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 262A81C3D7; Wed, 19 Dec 2018 22:30:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBJMUQCW039051; Wed, 19 Dec 2018 22:30:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBJMUQI7039050; Wed, 19 Dec 2018 22:30:26 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812192230.wBJMUQI7039050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 19 Dec 2018 22:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342247 - head/sys/security/mac X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/security/mac X-SVN-Commit-Revision: 342247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 36C1672EDE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2018 22:30:27 -0000 Author: mjg Date: Wed Dec 19 22:30:26 2018 New Revision: 342247 URL: https://svnweb.freebsd.org/changeset/base/342247 Log: mac: reduce pessimization of sdt probe handling Prior to the change the code would branch on return value and then check if probes are enabled. Since vast majority of the time they are not, this is clearly wasteful. Check probes first. Sponsored by: The FreeBSD Foundation Modified: head/sys/security/mac/mac_internal.h Modified: head/sys/security/mac/mac_internal.h ============================================================================== --- head/sys/security/mac/mac_internal.h Wed Dec 19 22:17:24 2018 (r342246) +++ head/sys/security/mac/mac_internal.h Wed Dec 19 22:30:26 2018 (r342247) @@ -98,12 +98,14 @@ SDT_PROVIDER_DECLARE(mac_framework); /* Entry points t "int", arg0); #define MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, arg3) do { \ - if (error) { \ - SDT_PROBE5(mac_framework, , name, mac__check__err, \ - error, arg0, arg1, arg2, arg3); \ - } else { \ - SDT_PROBE5(mac_framework, , name, mac__check__ok, \ - 0, arg0, arg1, arg2, arg3); \ + if (SDT_PROBES_ENABLED()) { \ + if (error) { \ + SDT_PROBE5(mac_framework, , name, mac__check__err,\ + error, arg0, arg1, arg2, arg3); \ + } else { \ + SDT_PROBE5(mac_framework, , name, mac__check__ok,\ + 0, arg0, arg1, arg2, arg3); \ + } \ } \ } while (0) @@ -122,12 +124,14 @@ SDT_PROVIDER_DECLARE(mac_framework); /* Entry points t "int", arg0, arg1); #define MAC_GRANT_PROBE2(name, error, arg0, arg1) do { \ - if (error) { \ - SDT_PROBE3(mac_framework, , name, mac__grant__err, \ - error, arg0, arg1); \ - } else { \ - SDT_PROBE3(mac_framework, , name, mac__grant__ok, \ - error, arg0, arg1); \ + if (SDT_PROBES_ENABLED()) { \ + if (error) { \ + SDT_PROBE3(mac_framework, , name, mac__grant__err,\ + error, arg0, arg1); \ + } else { \ + SDT_PROBE3(mac_framework, , name, mac__grant__ok,\ + error, arg0, arg1); \ + } \ } \ } while (0)