Changeset View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | |||||
* /etc/system. | * /etc/system. | ||||
*/ | */ | ||||
int dtrace_destructive_disallow = 0; | int dtrace_destructive_disallow = 0; | ||||
#ifndef illumos | #ifndef illumos | ||||
/* Positive logic version of dtrace_destructive_disallow for loader tunable */ | /* Positive logic version of dtrace_destructive_disallow for loader tunable */ | ||||
int dtrace_allow_destructive = 1; | int dtrace_allow_destructive = 1; | ||||
#endif | #endif | ||||
dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); | dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); | ||||
dtrace_optval_t dtrace_buffer_maxsize = (16 * 1024 * 1024); | |||||
size_t dtrace_difo_maxsize = (256 * 1024); | size_t dtrace_difo_maxsize = (256 * 1024); | ||||
dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); | dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); | ||||
size_t dtrace_statvar_maxsize = (16 * 1024); | size_t dtrace_statvar_maxsize = (16 * 1024); | ||||
size_t dtrace_actions_max = (16 * 1024); | size_t dtrace_actions_max = (16 * 1024); | ||||
size_t dtrace_retain_max = 1024; | size_t dtrace_retain_max = 1024; | ||||
dtrace_optval_t dtrace_helper_actions_max = 128; | dtrace_optval_t dtrace_helper_actions_max = 128; | ||||
dtrace_optval_t dtrace_helper_providers_max = 32; | dtrace_optval_t dtrace_helper_providers_max = 32; | ||||
dtrace_optval_t dtrace_dstate_defsize = (1 * 1024 * 1024); | dtrace_optval_t dtrace_dstate_defsize = (1 * 1024 * 1024); | ||||
▲ Show 20 Lines • Show All 11,937 Lines • ▼ Show 20 Lines | do { | ||||
buf->dtb_tomax = NULL; | buf->dtb_tomax = NULL; | ||||
buf->dtb_xamot = NULL; | buf->dtb_xamot = NULL; | ||||
buf->dtb_size = 0; | buf->dtb_size = 0; | ||||
} while ((cp = cp->cpu_next) != cpu_list); | } while ((cp = cp->cpu_next) != cpu_list); | ||||
#else | #else | ||||
int i; | int i; | ||||
*factor = 1; | if (size > dtrace_buffer_maxsize) | ||||
rstone: I like that this is tunable but isn't this allocated per-cpu? As I understand it the original… | |||||
gnnAuthorUnsubmitted Done Inline ActionsI don't know of any systems with 40 cores that don't also have 128G or more of RAM. Also,note that the tunable is 16m, so even with 40 cores that's "only" 640M, and no one needs more than 640...M gnn: I don't know of any systems with 40 cores that don't also have 128G or more of RAM. Also,note… | |||||
#if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ | |||||
defined(__mips__) || defined(__powerpc__) || defined(__riscv__) | |||||
/* | |||||
* FreeBSD isn't good at limiting the amount of memory we | |||||
markjUnsubmitted Not Done Inline ActionsI don't really understand what this comment means. We don't sleep here if there's a memory shortage, so an allocation failure should just cause us to release any already-allocated buffers and bail. Am I missing something? markj: I don't really understand what this comment means. We don't sleep here if there's a memory… | |||||
gnnAuthorUnsubmitted Not Done Inline ActionsIf you like I can also remove the comment. That's not original to me. gnn: If you like I can also remove the comment. That's not original to me. | |||||
markjUnsubmitted Not Done Inline ActionsHmm. libdtrace also needs to allocate buffers of this size for when it copies the kernel buffers, so one can, for instance, trigger the OOM killer by using a large enough buffer size. In that case, we should probably set buffer_maxsize based on physmem/ncpu. See r261122. markj: Hmm. libdtrace also needs to allocate buffers of this size for when it copies the kernel… | |||||
gnnAuthorUnsubmitted Not Done Inline ActionsIn 261122 all the limits were removed in libdtrace. Are you suggesting that due to that change I should at least do a protection setting of: if (size > physmem * PAGE_SIZE) at this point? gnn: In 261122 all the limits were removed in libdtrace. Are you suggesting that due to that change… | |||||
* ask to malloc, so let's place a limit here before trying | |||||
* to do something that might well end in tears at bedtime. | |||||
*/ | |||||
if (size > physmem * PAGE_SIZE / (128 * (mp_maxid + 1))) | |||||
return (ENOMEM); | return (ENOMEM); | ||||
#endif | |||||
*factor = 1; | |||||
ASSERT(MUTEX_HELD(&dtrace_lock)); | ASSERT(MUTEX_HELD(&dtrace_lock)); | ||||
CPU_FOREACH(i) { | CPU_FOREACH(i) { | ||||
if (cpu != DTRACE_CPUALL && cpu != i) | if (cpu != DTRACE_CPUALL && cpu != i) | ||||
continue; | continue; | ||||
buf = &bufs[i]; | buf = &bufs[i]; | ||||
▲ Show 20 Lines • Show All 6,222 Lines • Show Last 20 Lines |
I like that this is tunable but isn't this allocated per-cpu? As I understand it the original heuristic was attempting to prevent us from allocating too much on large-cpu count machines.
Maybe that's irrelevant because for us "large cpu count" implies "huge amounts of memory"