svn commit: r342247 - head/sys/security/mac
Mateusz Guzik
mjg at FreeBSD.org
Wed Dec 19 22:30:27 UTC 2018
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)
More information about the svn-src-all
mailing list