diff options
author | mjg <mjg@FreeBSD.org> | 2018-01-02 00:11:56 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2018-01-02 00:11:56 +0000 |
commit | ea78e9d88f2e3e927dfc146cad3b311b12292cc3 (patch) | |
tree | 000ac294c20b9477e97e25a663a79911678b4f53 /sys/cddl | |
parent | 075f7f627bb213a5cb1c0805bac208ef1e3f9391 (diff) | |
download | FreeBSD-src-ea78e9d88f2e3e927dfc146cad3b311b12292cc3.zip FreeBSD-src-ea78e9d88f2e3e927dfc146cad3b311b12292cc3.tar.gz |
MFC r324867,r324869:
sdt: whack unused SDT_PROBE_ENABLED
=============
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.
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/dev/sdt/sdt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c index 26a41f0..e9d0118 100644 --- a/sys/cddl/dev/sdt/sdt.c +++ b/sys/cddl/dev/sdt/sdt.c @@ -76,6 +76,8 @@ static void sdt_kld_unload_try(void *, struct linker_file *, int *); static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); +static int sdt_probes_enabled_count; + static dtrace_pattr_t sdt_attr = { { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, @@ -208,6 +210,9 @@ sdt_enable(void *arg __unused, dtrace_id_t id, void *parg) probe->sdtp_lf->nenabled++; if (strcmp(probe->prov->name, "lockstat") == 0) lockstat_enabled++; + sdt_probes_enabled_count++; + if (sdt_probes_enabled_count == 1) + sdt_probes_enabled = true; } static void @@ -217,6 +222,9 @@ sdt_disable(void *arg __unused, dtrace_id_t id, void *parg) KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled")); + sdt_probes_enabled_count--; + if (sdt_probes_enabled_count == 0) + sdt_probes_enabled = false; if (strcmp(probe->prov->name, "lockstat") == 0) lockstat_enabled--; probe->id = 0; |