From 5a17c5524fe977d5b8fddac04d24184d80824196 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sun, 22 Oct 2017 20:22:23 +0000 Subject: sdt: make all sdt probe sites test one variable This saves on cache misses at the expense of a slight grow of .text. Note this is a bandaid for lack of hotpatching. Discussed with: markj --- sys/sys/sdt.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/sys') diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h index 25423d764e3c..6771bf9f1177 100644 --- a/sys/sys/sdt.h +++ b/sys/sys/sdt.h @@ -80,6 +80,8 @@ #include #include +extern volatile bool sdt_probes_enabled; + #ifndef KDTRACE_HOOKS #define SDT_PROVIDER_DEFINE(prov) @@ -161,10 +163,12 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ - if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ + if (__predict_false(sdt_probes_enabled)) { \ + if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ (uintptr_t) arg3, (uintptr_t) arg4); \ + } \ } while (0) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \ -- cgit v1.2.3