Make the number of fasttrap probes and the size of the trace points hash table
tunable via sysctl or kernel tunables. Illumos allows this parameters to be changed via the fasttrap.conf configuration file, but FreeBSD code hardcoded the parameters. Expose them under the kern.dtrace.fasttrap sysctl tree. MFC after: 2 weeks
This commit is contained in:
parent
10b2e06e3e
commit
314eeef290
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291545
@ -63,6 +63,7 @@
|
||||
#ifndef illumos
|
||||
#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>
|
||||
@ -172,13 +173,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 +228,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)
|
||||
{
|
||||
@ -2480,8 +2493,6 @@ fasttrap_load(void)
|
||||
#ifdef illumos
|
||||
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;
|
||||
|
||||
@ -2492,12 +2503,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
|
||||
|
Loading…
Reference in New Issue
Block a user