mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Revert r260091. The vmem calls seem to be slower than the *_unr() calls that
they replaced, which is important considering that probe IDs are allocated during process startup for USDT probes.
This commit is contained in:
parent
b10852181e
commit
a333376bba
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260131
@ -206,11 +206,12 @@ const char dtrace_zero[256] = { 0 }; /* zero-filled memory */
|
||||
#if defined(sun)
|
||||
static dev_info_t *dtrace_devi; /* device info */
|
||||
#endif
|
||||
static vmem_t *dtrace_arena; /* probe ID arena */
|
||||
#if defined(sun)
|
||||
static vmem_t *dtrace_arena; /* probe ID arena */
|
||||
static vmem_t *dtrace_minor; /* minor number arena */
|
||||
#else
|
||||
static taskq_t *dtrace_taskq; /* task queue */
|
||||
static struct unrhdr *dtrace_arena; /* Probe ID number. */
|
||||
#endif
|
||||
static dtrace_probe_t **dtrace_probes; /* array of all probes */
|
||||
static int dtrace_nprobes; /* number of probes */
|
||||
@ -7831,7 +7832,7 @@ dtrace_unregister(dtrace_provider_id_t id)
|
||||
#if defined(sun)
|
||||
vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1);
|
||||
#else
|
||||
vmem_free(dtrace_arena, (vmem_addr_t)(probe->dtpr_id), 1);
|
||||
free_unr(dtrace_arena, probe->dtpr_id);
|
||||
#endif
|
||||
kmem_free(probe, sizeof (dtrace_probe_t));
|
||||
}
|
||||
@ -7952,7 +7953,7 @@ dtrace_condense(dtrace_provider_id_t id)
|
||||
#if defined(sun)
|
||||
vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1);
|
||||
#else
|
||||
vmem_free(dtrace_arena, (vmem_addr_t)i + 1, 1);
|
||||
free_unr(dtrace_arena, i + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -7982,9 +7983,6 @@ dtrace_probe_create(dtrace_provider_id_t prov, const char *mod,
|
||||
dtrace_probe_t *probe, **probes;
|
||||
dtrace_provider_t *provider = (dtrace_provider_t *)prov;
|
||||
dtrace_id_t id;
|
||||
#if !defined(sun)
|
||||
vmem_addr_t addr;
|
||||
#endif
|
||||
|
||||
if (provider == dtrace_provider) {
|
||||
ASSERT(MUTEX_HELD(&dtrace_lock));
|
||||
@ -7994,10 +7992,9 @@ dtrace_probe_create(dtrace_provider_id_t prov, const char *mod,
|
||||
|
||||
#if defined(sun)
|
||||
id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1,
|
||||
VM_BESTFIT | VM_WAITOK);
|
||||
VM_BESTFIT | VM_SLEEP);
|
||||
#else
|
||||
vmem_alloc(dtrace_arena, 1, M_BESTFIT | M_WAITOK, &addr);
|
||||
id = (dtrace_id_t)addr;
|
||||
id = alloc_unr(dtrace_arena);
|
||||
#endif
|
||||
probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP);
|
||||
|
||||
@ -10048,9 +10045,6 @@ dtrace_ecb_aggregation_create(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc)
|
||||
dtrace_recdesc_t *frec;
|
||||
dtrace_aggid_t aggid;
|
||||
dtrace_state_t *state = ecb->dte_state;
|
||||
#if !defined(sun)
|
||||
vmem_addr_t addr;
|
||||
#endif
|
||||
|
||||
agg = kmem_zalloc(sizeof (dtrace_aggregation_t), KM_SLEEP);
|
||||
agg->dtag_ecb = ecb;
|
||||
@ -10190,8 +10184,7 @@ dtrace_ecb_aggregation_create(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc)
|
||||
aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1,
|
||||
VM_BESTFIT | VM_SLEEP);
|
||||
#else
|
||||
vmem_alloc(state->dts_aggid_arena, 1, M_BESTFIT | M_WAITOK, &addr);
|
||||
aggid = (dtrace_aggid_t)addr;
|
||||
aggid = alloc_unr(state->dts_aggid_arena);
|
||||
#endif
|
||||
|
||||
if (aggid - 1 >= state->dts_naggregations) {
|
||||
@ -10244,7 +10237,7 @@ dtrace_ecb_aggregation_destroy(dtrace_ecb_t *ecb, dtrace_action_t *act)
|
||||
#if defined(sun)
|
||||
vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1);
|
||||
#else
|
||||
vmem_free(state->dts_aggid_arena, (vmem_addr_t)aggid, 1);
|
||||
free_unr(state->dts_aggid_arena, aggid);
|
||||
#endif
|
||||
|
||||
ASSERT(state->dts_aggregations[aggid - 1] == agg);
|
||||
@ -13212,7 +13205,7 @@ dtrace_state_create(struct cdev *dev)
|
||||
if (dev != NULL) {
|
||||
cr = dev->si_cred;
|
||||
m = dev2unit(dev);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate memory for the state. */
|
||||
state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP);
|
||||
@ -13224,12 +13217,7 @@ dtrace_state_create(struct cdev *dev)
|
||||
#if defined(sun)
|
||||
state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1,
|
||||
NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
|
||||
#else
|
||||
state->dts_aggid_arena = vmem_create(c, (vmem_addr_t)1, UINT32_MAX, 1,
|
||||
0, M_WAITOK);
|
||||
#endif
|
||||
|
||||
#if defined(sun)
|
||||
if (devp != NULL) {
|
||||
major = getemajor(*devp);
|
||||
} else {
|
||||
@ -13241,6 +13229,7 @@ dtrace_state_create(struct cdev *dev)
|
||||
if (devp != NULL)
|
||||
*devp = state->dts_dev;
|
||||
#else
|
||||
state->dts_aggid_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx);
|
||||
state->dts_dev = dev;
|
||||
#endif
|
||||
|
||||
@ -14047,7 +14036,11 @@ dtrace_state_destroy(dtrace_state_t *state)
|
||||
dtrace_format_destroy(state);
|
||||
|
||||
if (state->dts_aggid_arena != NULL) {
|
||||
#if defined(sun)
|
||||
vmem_destroy(state->dts_aggid_arena);
|
||||
#else
|
||||
delete_unrhdr(state->dts_aggid_arena);
|
||||
#endif
|
||||
state->dts_aggid_arena = NULL;
|
||||
}
|
||||
#if defined(sun)
|
||||
@ -15382,7 +15375,7 @@ dtrace_module_unloaded(modctl_t *ctl, int *error)
|
||||
#if defined(sun)
|
||||
vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1);
|
||||
#else
|
||||
vmem_free(dtrace_arena, (vmem_addr_t)probe->dtpr_id, 1);
|
||||
free_unr(dtrace_arena, probe->dtpr_id);
|
||||
#endif
|
||||
kmem_free(probe, sizeof (dtrace_probe_t));
|
||||
}
|
||||
|
@ -1139,7 +1139,11 @@ struct dtrace_state {
|
||||
int dts_nspeculations; /* number of speculations */
|
||||
int dts_naggregations; /* number of aggregations */
|
||||
dtrace_aggregation_t **dts_aggregations; /* aggregation array */
|
||||
#if defined(sun)
|
||||
vmem_t *dts_aggid_arena; /* arena for aggregation IDs */
|
||||
#else
|
||||
struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */
|
||||
#endif
|
||||
uint64_t dts_errors; /* total number of errors */
|
||||
uint32_t dts_speculations_busy; /* number of spec. busy */
|
||||
uint32_t dts_speculations_unavail; /* number of spec unavail */
|
||||
|
@ -58,9 +58,6 @@ dtrace_load(void *dummy)
|
||||
|
||||
dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0);
|
||||
|
||||
dtrace_arena = vmem_create("dtrace", 1, UINT32_MAX, 1, 0,
|
||||
M_WAITOK | M_BESTFIT);
|
||||
|
||||
/* Register callbacks for linker file load and unload events. */
|
||||
dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load,
|
||||
dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY);
|
||||
@ -88,6 +85,8 @@ dtrace_load(void *dummy)
|
||||
|
||||
ASSERT(MUTEX_HELD(&cpu_lock));
|
||||
|
||||
dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx);
|
||||
|
||||
dtrace_state_cache = kmem_cache_create("dtrace_state_cache",
|
||||
sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN,
|
||||
NULL, NULL, NULL, NULL, NULL, 0);
|
||||
|
@ -104,7 +104,7 @@ dtrace_unload()
|
||||
|
||||
kmem_cache_destroy(dtrace_state_cache);
|
||||
|
||||
vmem_destroy(dtrace_arena);
|
||||
delete_unrhdr(dtrace_arena);
|
||||
|
||||
if (dtrace_toxrange != NULL) {
|
||||
kmem_free(dtrace_toxrange, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user