Lines Matching +full:clip +full:- +full:y +full:- +full:high

45  * priority than the per-binary setting, which gets lower priority than the /etc
51 * those circumstances). For these use cases, it's handy to have an in-binary
135 * These are the documented values for junk fill debugging facilities -- see the
182 /* Below three are read-only after initialization. */
339 * FreeBSD's libc uses the bootstrap_*() functions in bootstrap-sensitive
464 unsigned shard = atomic_fetch_add_u(&arena->binshard_next, 1,
470 bins->binshard[i] = shard % bin_infos[i].n_shards;
525 * Determine binding for both non-internal and internal
659 malloc_mutex_lock(tsdn, &arena->tcache_ql_mtx);
660 ql_foreach(tcache_slow, &arena->tcache_ql,
663 tcache_slow->tcache, arena);
666 &arena->tcache_ql_mtx);
755 return ((result == -1) ? 1 : (unsigned)result);
760 * - sched_getaffinity()
761 * - _SC_NPROCESSORS_ONLN
762 * - _SC_NPROCESSORS_CONF
821 /* Reads the next size pair in a multi-sized option. */
831 /* First number, then '-' */
833 if (get_errno() != 0 || *end != '-') {
859 *vlen_left -= end - *slab_size_segment_cur;
879 case 'Y': case 'Z':
884 case 'y': case 'z':
892 *klen_p = (uintptr_t)opts - 1 - (uintptr_t)*k_p;
926 *vlen_p = (uintptr_t)opts - 1 - (uintptr_t)*v_p;
930 *vlen_p = (uintptr_t)opts - (uintptr_t)*v_p;
1030 if (linklen == -1) {
1074 "string specified via --with-malloc-conf",
1113 malloc_printf("<jemalloc>: -- " \
1121 (sizeof(n)-1 == klen && strncmp(n, k, klen) == 0)
1123 (sizeof(n)-1 == vlen && strncmp(n, v, vlen) == 0)
1139 * GCC -Wtype-limits warning, which we disable here and re-enable below.
1154 (get_errno() != 0 || (uintptr_t)end - (uintptr_t)v != vlen)
1156 #define CONF_HANDLE_T(t, max_t, o, n, min, max, check_min, check_max, clip) \
1163 } else if (clip) { \
1176 "Out-of-range " \
1185 #define CONF_HANDLE_T_U(t, o, n, min, max, check_min, check_max, clip) \
1187 check_max, clip)
1188 #define CONF_HANDLE_T_SIGNED(t, o, n, min, max, check_min, check_max, clip)\
1190 check_max, clip)
1193 clip) \
1195 check_min, check_max, clip)
1196 #define CONF_HANDLE_SIZE_T(o, n, min, max, check_min, check_max, clip) \
1198 check_min, check_max, clip)
1199 #define CONF_HANDLE_INT64_T(o, n, min, max, check_min, check_max, clip) \
1201 check_min, check_max, clip)
1202 #define CONF_HANDLE_UINT64_T(o, n, min, max, check_min, check_max, clip)\
1204 check_min, check_max, clip)
1211 sizeof(o)-1) ? vlen : \
1212 sizeof(o)-1; \
1278 /* clip */ false)
1285 if (err || (size_t)(end - v) != vlen) {
1314 "mutex_max_spin", -1, INT64_MAX, CONF_CHECK_MIN,
1317 "dirty_decay_ms", -1, NSTIME_SEC_MAX * KQU(1000) <
1321 "muzzy_decay_ms", -1, NSTIME_SEC_MAX * KQU(1000) <
1331 "stats_interval", -1, INT64_MAX,
1380 CONF_CHECK_MAX, /* clip */ true)
1388 /* clip if necessary */
1397 * Anyone trying to set a value outside -16 to 16 is
1401 "lg_tcache_nslots_mul", -16, 16)
1405 CONF_CHECK_MIN, CONF_CHECK_MAX, /* clip */ true)
1408 CONF_CHECK_MIN, CONF_CHECK_MAX, /* clip */ true)
1411 CONF_CHECK_MIN, CONF_CHECK_MAX, /* clip */ true)
1415 /* clip */ true)
1419 /* clip */ false)
1422 CONF_CHECK_MIN, CONF_CHECK_MAX, /* clip */ true)
1425 CONF_CHECK_MIN, CONF_CHECK_MAX, /* clip */ true)
1478 * Accept either a ratio-based or an exact hugification
1489 if (err || (size_t)(end - v) != vlen
1511 if (CONF_MATCH_VALUE("-1")) {
1512 opt_hpa_opts.dirty_mult = (fxp_t)-1;
1519 if (err || (size_t)(end - v) != vlen) {
1581 - 1, CONF_DONT_CHECK_MIN, CONF_CHECK_MAX,
1585 "lg_prof_interval", -1,
1586 (sizeof(uint64_t) << 3) - 1)
1594 "prof_recent_alloc_max", -1, SSIZE_MAX)
1602 } else if (CONF_MATCH_VALUE("high")) {
1605 "No high resolution"
1633 vlen : sizeof(log_var_names) - 1);
1680 if (CONF_VALUE_READ_FAIL() || a < -1) {
1684 if (a == -1) {
1685 opt_lg_san_uaf_align = -1;
1689 /* clip if necessary */
1690 ssize_t max_allowed = (sizeof(size_t) << 3) - 1;
1726 /* Re-enable diagnostic "-Wtype-limits" */
1780 /* Busy-wait until the initializing thread completes. */
1906 if (pa_shard_enable_hpa(TSDN_NULL, &a0->pa_shard,
1945 "detected is not deterministic. Per-CPU "
2036 "configuration -- per physical CPU arena "
2073 narenas_auto = MALLOCX_ARENA_LIMIT - 1;
2193 * Begin allocation-path internal functions and data structures.
2230 /* The error string to use if the passed-in alignment is invalid. */
2234 * False if we're configured to skip some time-consuming operations.
2249 static_opts->may_overflow = false;
2250 static_opts->bump_empty_aligned_alloc = false;
2251 static_opts->assert_nonempty_alloc = false;
2252 static_opts->null_out_result_on_error = false;
2253 static_opts->set_errno_on_error = false;
2254 static_opts->min_alignment = 0;
2255 static_opts->oom_string = "";
2256 static_opts->invalid_alignment_string = "";
2257 static_opts->slow = false;
2258 static_opts->usize = false;
2266 #define TCACHE_IND_NONE ((unsigned)-1)
2267 #define TCACHE_IND_AUTOMATIC ((unsigned)-2)
2268 #define ARENA_IND_AUTOMATIC ((unsigned)-1)
2284 dynamic_opts->result = NULL;
2285 dynamic_opts->usize = 0;
2286 dynamic_opts->num_items = 0;
2287 dynamic_opts->item_size = 0;
2288 dynamic_opts->alignment = 0;
2289 dynamic_opts->zero = false;
2290 dynamic_opts->tcache_ind = TCACHE_IND_AUTOMATIC;
2291 dynamic_opts->arena_ind = ARENA_IND_AUTOMATIC;
2383 /* ind is ignored if dopts->alignment > 0. */
2388 tcache_t *tcache = tcache_get_from_ind(tsd, dopts->tcache_ind,
2389 sopts->slow, /* is_alloc */ true);
2393 if (arena_get_from_ind(tsd, dopts->arena_ind, &arena)) {
2397 if (unlikely(dopts->alignment != 0)) {
2398 return ipalloct(tsd_tsdn(tsd), usize, dopts->alignment,
2399 dopts->zero, tcache, arena);
2402 return iallocztm(tsd_tsdn(tsd), size, ind, dopts->zero, tcache, false,
2403 arena, sopts->slow);
2418 dopts->alignment = prof_sample_align(dopts->alignment);
2420 assert(((dopts->alignment == 0) ?
2422 sz_sa2u(SC_LARGE_MINCLASS, dopts->alignment))
2453 assert(dopts->num_items == 1);
2454 *size = dopts->item_size;
2458 /* A size_t with its high-half bits all set to 1. */
2461 *size = dopts->item_size * dopts->num_items;
2464 return (dopts->num_items != 0 && dopts->item_size != 0);
2468 * We got a non-zero size, but we don't know if we overflowed to get
2473 if (likely((high_bits & (dopts->num_items | dopts->item_size)) == 0)) {
2476 if (likely(*size / dopts->item_size == dopts->num_items)) {
2502 if (unlikely(compute_size_with_overflow(sopts->may_overflow, dopts,
2507 if (unlikely(dopts->alignment < sopts->min_alignment
2508 || (dopts->alignment & (dopts->alignment - 1)) != 0)) {
2513 dopts->zero = zero_get(dopts->zero, sopts->slow);
2514 if (aligned_usize_get(size, dopts->alignment, &usize, &ind,
2515 sopts->bump_empty_aligned_alloc)) {
2518 dopts->usize = usize;
2520 if (sopts->assert_nonempty_alloc) {
2528 * known-initialized arena (i.e. arena 0).
2531 if (sopts->slow && unlikely(reentrancy_level > 0)) {
2536 assert(dopts->tcache_ind == TCACHE_IND_AUTOMATIC ||
2537 dopts->tcache_ind == TCACHE_IND_NONE);
2538 assert(dopts->arena_ind == ARENA_IND_AUTOMATIC);
2539 dopts->tcache_ind = TCACHE_IND_NONE;
2541 dopts->arena_ind = 0;
2545 * If dopts->alignment > 0, then ind is still 0, but usize was computed
2586 * post-allocation work to do though.
2591 assert(dopts->alignment == 0
2592 || ((uintptr_t)allocation & (dopts->alignment - 1)) == ZU(0));
2596 if (config_fill && sopts->slow && !dopts->zero
2601 if (sopts->slow) {
2607 *dopts->result = allocation;
2611 if (unlikely(sopts->slow) && config_xmalloc && unlikely(opt_xmalloc)) {
2612 malloc_write(sopts->oom_string);
2616 if (sopts->slow) {
2622 if (sopts->set_errno_on_error) {
2626 if (sopts->null_out_result_on_error) {
2627 *dopts->result = NULL;
2634 * anyways to avoid obscuring the non-error paths, and for symmetry with
2639 malloc_write(sopts->invalid_alignment_string);
2643 if (sopts->set_errno_on_error) {
2647 if (sopts->slow) {
2653 if (sopts->null_out_result_on_error) {
2654 *dopts->result = NULL;
2664 malloc_write(sopts->oom_string);
2667 UTRACE(NULL, dopts->num_items * dopts->item_size, NULL);
2669 *dopts->result = NULL;
2677 /* Returns the errno-style error code of the allocation. */
2690 sopts->slow = false;
2697 sopts->slow = true;
2728 * Note that this branch gets optimized away -- it immediately follows
2743 * Begin malloc(3)-compatible functions.
2909 if (alloc_ctx->szind != dbg_ctx.szind) {
2913 /* input_size */ sz_size2index(alloc_ctx->szind));
2916 if (alloc_ctx->slab != dbg_ctx.slab) {
3005 * based on only free() calls -- other activities trigger the
3009 * fully-setup tsd won't be destructed properly.
3036 * objects and 2) sampled junk & stash for use-after-free detection.
3039 * prof_sample is page-aligned, which covers the UAF check when both
3041 * this is on the fastpath -- at most one runtime branch from this.
3125 * Check for events and tsd non-nominal (fast_threshold will be set to
3127 * as well (TSD init will be triggered on the non-fastpath). Therefore
3143 cache_bin_t *bin = &tcache->bins[alloc_ctx.szind];
3148 * that to double-check.
3173 * End malloc(3)-compatible functions.
3177 * Begin non-standard override functions.
3260 * to inconsistently reference libc's malloc(3)-compatible functions
3313 * End non-standard override functions.
3317 * Begin non-standard functions.
3342 #define JEMALLOC_SMALLOCX_CONCAT_HELPER(x, y) x ## y
3343 #define JEMALLOC_SMALLOCX_CONCAT_HELPER2(x, y) \
3344 JEMALLOC_SMALLOCX_CONCAT_HELPER(x, y)
3355 * - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86488
3548 assert(alignment == 0 || ((uintptr_t)p & (alignment - 1)) == ZU(0));
3557 size_t excess_len = usize - old_usize;
3613 safety_check_fail("Called realloc(non-null-ptr, 0) with "
3704 * usize isn't knowable before ixalloc() returns when extra is non-zero.
3768 assert(SIZE_T_MAX - size >= extra);
3800 if (unlikely(SC_LARGE_MAXCLASS - size < extra)) {
3801 extra = SC_LARGE_MAXCLASS - size;
3827 size_t excess_len = usize - old_usize;
4171 size_t batch = num - filled;
4183 batch -= surplus / usize + 1;
4203 size_t arena_batch = batch - batch % nregs;
4217 bin = &tcache->bins[ind];
4229 size_t bin_batch = batch - progress;
4250 bin->tstats.nrequests += n;
4301 * End non-standard functions.
4309 #define ALLOCM_ALIGN(a) (ffsl(a)-1)
4337 assert(SIZE_T_MAX - size >= extra);