summaryrefslogtreecommitdiffstats
path: root/sys/sys/sdt.h
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2017-03-16 06:45:36 +0000
committermjg <mjg@FreeBSD.org>2017-03-16 06:45:36 +0000
commitf690d08c057e8a0ec75f68e6a3b2e1d3d68ec977 (patch)
tree79547747719192ef3f44b1bc780f86e4dc0eefc9 /sys/sys/sdt.h
parent75c730bce9acd14b7ecb04b7be87b14661c92be3 (diff)
downloadFreeBSD-src-f690d08c057e8a0ec75f68e6a3b2e1d3d68ec977.zip
FreeBSD-src-f690d08c057e8a0ec75f68e6a3b2e1d3d68ec977.tar.gz
MFC r313275,r313280,r313282,r313335:
mtx: move lockstat handling out of inline primitives Lockstat requires checking if it is enabled and if so, calling a 6 argument function. Further, determining whether to call it on unlock requires pre-reading the lock value. This is problematic in at least 3 ways: - more branches in the hot path than necessary - additional cacheline ping pong under contention - bigger code Instead, check first if lockstat handling is necessary and if so, just fall back to regular locking routines. For this purpose a new macro is introduced (LOCKSTAT_PROFILE_ENABLED). LOCK_PROFILING uninlines all primitives. Fold in the current inline lock variant into the _mtx_lock_flags to retain the support. With this change the inline variants are not used when LOCK_PROFILING is defined and thus can ignore its existence. This results in: text data bss dec hex filename 22259667 1303208 4994976 28557851 1b3c21b kernel.orig 21797315 1303208 4994976 28095499 1acb40b kernel.patched i.e. about 3% reduction in text size. A remaining action is to remove spurious arguments for internal kernel consumers. == sx: move lockstat handling out of inline primitives See r313275 for details. == rwlock: move lockstat handling out of inline primitives See r313275 for details. One difference here is that recursion handling was removed from the fallback routine. As it is it was never supposed to see a recursed lock in the first place. Future changes will move it out of inline variants, but right now there is no easy to way to test if the lock is recursed without reading additional words. == locks: fix recursion support after recent changes When a relevant lockstat probe is enabled the fallback primitive is called with a constant signifying a free lock. This works fine for typical cases but breaks with recursion, since it checks if the passed value is that of the executing thread. Read the value if necessary.
Diffstat (limited to 'sys/sys/sdt.h')
-rw-r--r--sys/sys/sdt.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 25423d7..4259883 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -160,6 +160,9 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
#define SDT_PROBE_DECLARE(prov, mod, func, name) \
extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
+#define SDT_PROBE_ENABLED(prov, mod, func, name) \
+ __predict_false((sdt_##prov##_##mod##_##func##_##name->id))
+
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \
if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \
OpenPOWER on IntegriCloud