diff options
author | stas <stas@FreeBSD.org> | 2016-01-08 03:45:28 +0000 |
---|---|---|
committer | stas <stas@FreeBSD.org> | 2016-01-08 03:45:28 +0000 |
commit | a223c7416c780e5e9e6df68f2c96e57397e93dc0 (patch) | |
tree | 1b4dd4e3192f6fd476d8531a3dd7b42cf98fa9cf /sys/cddl | |
parent | 2a244ee71dd1f37b450dc5f71a359d783850f45f (diff) | |
download | FreeBSD-src-a223c7416c780e5e9e6df68f2c96e57397e93dc0.zip FreeBSD-src-a223c7416c780e5e9e6df68f2c96e57397e93dc0.tar.gz |
MFC r291545: make the number of fasttrap probes and the size of the trace points hash table
tunable via sysctl or kernel tunables.
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c index 1954873..19fb43c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c @@ -63,6 +63,8 @@ #if !defined(sun) #include <sys/dtrace_bsd.h> #include <sys/eventhandler.h> +#include <sys/sysctl.h> +#include <sys/u8_textprep.h> #include <sys/user.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -172,13 +174,14 @@ static volatile uint64_t fasttrap_mod_gen; /* * When the fasttrap provider is loaded, fasttrap_max is set to either - * FASTTRAP_MAX_DEFAULT or the value for fasttrap-max-probes in the - * fasttrap.conf file. Each time a probe is created, fasttrap_total is - * incremented by the number of tracepoints that may be associated with that - * probe; fasttrap_total is capped at fasttrap_max. + * FASTTRAP_MAX_DEFAULT, or the value for fasttrap-max-probes in the + * fasttrap.conf file (Illumos), or the value provied in the loader.conf (FreeBSD). + * Each time a probe is created, fasttrap_total is incremented by the number + * of tracepoints that may be associated with that probe; fasttrap_total is capped + * at fasttrap_max. */ #define FASTTRAP_MAX_DEFAULT 250000 -static uint32_t fasttrap_max; +static uint32_t fasttrap_max = FASTTRAP_MAX_DEFAULT; static uint32_t fasttrap_total; /* @@ -226,6 +229,17 @@ static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; static eventhandler_tag fasttrap_thread_dtor_tag; #endif +static unsigned long tpoints_hash_size = FASTTRAP_TPOINTS_DEFAULT_SIZE; + +#ifdef __FreeBSD__ +SYSCTL_DECL(_kern_dtrace); +SYSCTL_NODE(_kern_dtrace, OID_AUTO, fasttrap, CTLFLAG_RD, 0, "DTrace fasttrap parameters"); +SYSCTL_UINT(_kern_dtrace_fasttrap, OID_AUTO, max_probes, CTLFLAG_RWTUN, &fasttrap_max, + FASTTRAP_MAX_DEFAULT, "Maximum number of fasttrap probes"); +SYSCTL_ULONG(_kern_dtrace_fasttrap, OID_AUTO, tpoints_hash_size, CTLFLAG_RDTUN, &tpoints_hash_size, + FASTTRAP_TPOINTS_DEFAULT_SIZE, "Size of the tracepoint hash table"); +#endif + static int fasttrap_highbit(ulong_t i) { @@ -2466,8 +2480,6 @@ fasttrap_load(void) #if defined(sun) fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT); -#else - fasttrap_max = FASTTRAP_MAX_DEFAULT; #endif fasttrap_total = 0; @@ -2478,12 +2490,14 @@ fasttrap_load(void) nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE); #else - nent = FASTTRAP_TPOINTS_DEFAULT_SIZE; + nent = tpoints_hash_size; #endif if (nent == 0 || nent > 0x1000000) nent = FASTTRAP_TPOINTS_DEFAULT_SIZE; + tpoints_hash_size = nent; + if (ISP2(nent)) fasttrap_tpoints.fth_nent = nent; else |