]> git.ipfire.org Git - thirdparty/glibc.git/blame - manual/tunables.texi
elf: Use new dependency sorting algorithm by default
[thirdparty/glibc.git] / manual / tunables.texi
CommitLineData
b31b4d6a
SP
1@node Tunables
2@c @node Tunables, , Internal Probes, Top
3@c %MENU% Tunable switches to alter libc internal behavior
4@chapter Tunables
5@cindex tunables
6
7@dfn{Tunables} are a feature in @theglibc{} that allows application authors and
8distribution maintainers to alter the runtime library behavior to match
9their workload. These are implemented as a set of switches that may be
10modified in different ways. The current default method to do this is via
11the @env{GLIBC_TUNABLES} environment variable by setting it to a string
12of colon-separated @var{name}=@var{value} pairs. For example, the following
bdc674d9
PE
13example enables @code{malloc} checking and sets the @code{malloc}
14trim threshold to 128
b31b4d6a
SP
15bytes:
16
17@example
18GLIBC_TUNABLES=glibc.malloc.trim_threshold=128:glibc.malloc.check=3
19export GLIBC_TUNABLES
20@end example
21
22Tunables are not part of the @glibcadj{} stable ABI, and they are
23subject to change or removal across releases. Additionally, the method to
24modify tunable values may change between releases and across distributions.
25It is possible to implement multiple `frontends' for the tunables allowing
26distributions to choose their preferred method at build time.
27
28Finally, the set of tunables available may vary between distributions as
29the tunables feature allows distributions to add their own tunables under
30their own namespace.
31
86f65dff
L
32Passing @option{--list-tunables} to the dynamic loader to print all
33tunables with minimum and maximum values:
34
35@example
36$ /lib64/ld-linux-x86-64.so.2 --list-tunables
37glibc.rtld.nns: 0x4 (min: 0x1, max: 0x10)
38glibc.elision.skip_lock_after_retries: 3 (min: -2147483648, max: 2147483647)
39glibc.malloc.trim_threshold: 0x0 (min: 0x0, max: 0xffffffffffffffff)
40glibc.malloc.perturb: 0 (min: 0, max: 255)
41glibc.cpu.x86_shared_cache_size: 0x100000 (min: 0x0, max: 0xffffffffffffffff)
42glibc.mem.tagging: 0 (min: 0, max: 255)
43glibc.elision.tries: 3 (min: -2147483648, max: 2147483647)
44glibc.elision.enable: 0 (min: 0, max: 1)
45glibc.cpu.x86_rep_movsb_threshold: 0x1000 (min: 0x100, max: 0xffffffffffffffff)
46glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0xffffffffffffffff)
47glibc.elision.skip_lock_busy: 3 (min: -2147483648, max: 2147483647)
48glibc.malloc.top_pad: 0x0 (min: 0x0, max: 0xffffffffffffffff)
49glibc.cpu.x86_rep_stosb_threshold: 0x800 (min: 0x1, max: 0xffffffffffffffff)
50glibc.cpu.x86_non_temporal_threshold: 0xc0000 (min: 0x0, max: 0xffffffffffffffff)
51glibc.cpu.x86_shstk:
52glibc.cpu.hwcap_mask: 0x6 (min: 0x0, max: 0xffffffffffffffff)
53glibc.malloc.mmap_max: 0 (min: -2147483648, max: 2147483647)
54glibc.elision.skip_trylock_internal_abort: 3 (min: -2147483648, max: 2147483647)
55glibc.malloc.tcache_unsorted_limit: 0x0 (min: 0x0, max: 0xffffffffffffffff)
56glibc.cpu.x86_ibt:
57glibc.cpu.hwcaps:
58glibc.elision.skip_lock_internal_abort: 3 (min: -2147483648, max: 2147483647)
59glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0xffffffffffffffff)
60glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0xffffffffffffffff)
61glibc.cpu.x86_data_cache_size: 0x8000 (min: 0x0, max: 0xffffffffffffffff)
62glibc.malloc.tcache_count: 0x0 (min: 0x0, max: 0xffffffffffffffff)
63glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0xffffffffffffffff)
64glibc.pthread.mutex_spin_count: 100 (min: 0, max: 32767)
65glibc.rtld.optional_static_tls: 0x200 (min: 0x0, max: 0xffffffffffffffff)
66glibc.malloc.tcache_max: 0x0 (min: 0x0, max: 0xffffffffffffffff)
67glibc.malloc.check: 0 (min: 0, max: 3)
68@end example
69
b31b4d6a
SP
70@menu
71* Tunable names:: The structure of a tunable name
72* Memory Allocation Tunables:: Tunables in the memory allocation subsystem
0c7b002f 73* Dynamic Linking Tunables:: Tunables in the dynamic linking subsystem
07ed18d2 74* Elision Tunables:: Tunables in elision subsystem
6310e6be 75* POSIX Thread Tunables:: Tunables in the POSIX thread subsystem
ea9b0ecb
SP
76* Hardware Capability Tunables:: Tunables that modify the hardware
77 capabilities seen by @theglibc{}
26450d04
RE
78* Memory Related Tunables:: Tunables that control the use of memory by
79 @theglibc{}.
b31b4d6a
SP
80@end menu
81
82@node Tunable names
83@section Tunable names
84@cindex Tunable names
85@cindex Tunable namespaces
86
87A tunable name is split into three components, a top namespace, a tunable
88namespace and the tunable name. The top namespace for tunables implemented in
89@theglibc{} is @code{glibc}. Distributions that choose to add custom tunables
90in their maintained versions of @theglibc{} may choose to do so under their own
91top namespace.
92
93The tunable namespace is a logical grouping of tunables in a single
94module. This currently holds no special significance, although that may
95change in the future.
96
97The tunable name is the actual name of the tunable. It is possible that
98different tunable namespaces may have tunables within them that have the
99same name, likewise for top namespaces. Hence, we only support
100identification of tunables by their full name, i.e. with the top
101namespace, tunable namespace and tunable name, separated by periods.
102
103@node Memory Allocation Tunables
104@section Memory Allocation Tunables
105@cindex memory allocation tunables
106@cindex malloc tunables
107@cindex tunables, malloc
108
109@deftp {Tunable namespace} glibc.malloc
110Memory allocation behavior can be modified by setting any of the
111following tunables in the @code{malloc} namespace:
112@end deftp
113
114@deftp Tunable glibc.malloc.check
115This tunable supersedes the @env{MALLOC_CHECK_} environment variable and is
2d2d9f2b 116identical in features. This tunable has no effect by default and needs the
fb1621a8 117debug library @file{libc_malloc_debug} to be preloaded using the
2d2d9f2b 118@code{LD_PRELOAD} environment variable.
b31b4d6a 119
83e55c98 120Setting this tunable to a non-zero value less than 4 enables a special (less
bdc674d9 121efficient) memory allocator for the @code{malloc} family of functions that is
ec2c1fce
FW
122designed to be tolerant against simple errors such as double calls of
123free with the same argument, or overruns of a single byte (off-by-one
124bugs). Not all such errors can be protected against, however, and memory
125leaks can result. Any detected heap corruption results in immediate
126termination of the process.
b31b4d6a
SP
127
128Like @env{MALLOC_CHECK_}, @code{glibc.malloc.check} has a problem in that it
129diverges from normal program behavior by writing to @code{stderr}, which could
130by exploited in SUID and SGID binaries. Therefore, @code{glibc.malloc.check}
131is disabled by default for SUID and SGID binaries. This can be enabled again
132by the system administrator by adding a file @file{/etc/suid-debug}; the
133content of the file could be anything or even empty.
134@end deftp
135
136@deftp Tunable glibc.malloc.top_pad
137This tunable supersedes the @env{MALLOC_TOP_PAD_} environment variable and is
138identical in features.
139
140This tunable determines the amount of extra memory in bytes to obtain from the
141system when any of the arenas need to be extended. It also specifies the
142number of bytes to retain when shrinking any of the arenas. This provides the
143necessary hysteresis in heap size such that excessive amounts of system calls
144can be avoided.
145
146The default value of this tunable is @samp{0}.
147@end deftp
148
149@deftp Tunable glibc.malloc.perturb
150This tunable supersedes the @env{MALLOC_PERTURB_} environment variable and is
151identical in features.
152
153If set to a non-zero value, memory blocks are initialized with values depending
154on some low order bits of this tunable when they are allocated (except when
bdc674d9 155allocated by @code{calloc}) and freed. This can be used to debug the use of
b31b4d6a
SP
156uninitialized or freed heap memory. Note that this option does not guarantee
157that the freed block will have any specific values. It only guarantees that the
158content the block had before it was freed will be overwritten.
159
160The default value of this tunable is @samp{0}.
161@end deftp
162
163@deftp Tunable glibc.malloc.mmap_threshold
164This tunable supersedes the @env{MALLOC_MMAP_THRESHOLD_} environment variable
165and is identical in features.
166
167When this tunable is set, all chunks larger than this value in bytes are
168allocated outside the normal heap, using the @code{mmap} system call. This way
169it is guaranteed that the memory for these chunks can be returned to the system
170on @code{free}. Note that requests smaller than this threshold might still be
171allocated via @code{mmap}.
172
173If this tunable is not set, the default value is set to @samp{131072} bytes and
174the threshold is adjusted dynamically to suit the allocation patterns of the
175program. If the tunable is set, the dynamic adjustment is disabled and the
176value is set as static.
177@end deftp
178
179@deftp Tunable glibc.malloc.trim_threshold
180This tunable supersedes the @env{MALLOC_TRIM_THRESHOLD_} environment variable
181and is identical in features.
182
183The value of this tunable is the minimum size (in bytes) of the top-most,
184releasable chunk in an arena that will trigger a system call in order to return
185memory to the system from that arena.
186
187If this tunable is not set, the default value is set as 128 KB and the
188threshold is adjusted dynamically to suit the allocation patterns of the
189program. If the tunable is set, the dynamic adjustment is disabled and the
190value is set as static.
191@end deftp
192
193@deftp Tunable glibc.malloc.mmap_max
194This tunable supersedes the @env{MALLOC_MMAP_MAX_} environment variable and is
195identical in features.
196
197The value of this tunable is maximum number of chunks to allocate with
198@code{mmap}. Setting this to zero disables all use of @code{mmap}.
199
200The default value of this tunable is @samp{65536}.
201@end deftp
202
203@deftp Tunable glibc.malloc.arena_test
204This tunable supersedes the @env{MALLOC_ARENA_TEST} environment variable and is
205identical in features.
206
207The @code{glibc.malloc.arena_test} tunable specifies the number of arenas that
208can be created before the test on the limit to the number of arenas is
209conducted. The value is ignored if @code{glibc.malloc.arena_max} is set.
210
211The default value of this tunable is 2 for 32-bit systems and 8 for 64-bit
212systems.
213@end deftp
214
215@deftp Tunable glibc.malloc.arena_max
216This tunable supersedes the @env{MALLOC_ARENA_MAX} environment variable and is
217identical in features.
218
219This tunable sets the number of arenas to use in a process regardless of the
220number of cores in the system.
221
222The default value of this tunable is @code{0}, meaning that the limit on the
223number of arenas is determined by the number of CPU cores online. For 32-bit
224systems the limit is twice the number of cores online and on 64-bit systems, it
225is 8 times the number of cores online.
226@end deftp
ea9b0ecb 227
d5c3fafc
DD
228@deftp Tunable glibc.malloc.tcache_max
229The maximum size of a request (in bytes) which may be met via the
230per-thread cache. The default (and maximum) value is 1032 bytes on
23164-bit systems and 516 bytes on 32-bit systems.
232@end deftp
233
234@deftp Tunable glibc.malloc.tcache_count
235The maximum number of chunks of each size to cache. The default is 7.
1f50f2ad 236The upper limit is 65535. If set to zero, the per-thread cache is effectively
5ad533e8 237disabled.
d5c3fafc
DD
238
239The approximate maximum overhead of the per-thread cache is thus equal
240to the number of bins times the chunk count in each bin times the size
241of each chunk. With defaults, the approximate maximum overhead of the
242per-thread cache is approximately 236 KB on 64-bit systems and 118 KB
243on 32-bit systems.
244@end deftp
245
246@deftp Tunable glibc.malloc.tcache_unsorted_limit
247When the user requests memory and the request cannot be met via the
248per-thread cache, the arenas are used to meet the request. At this
249time, additional chunks will be moved from existing arena lists to
250pre-fill the corresponding cache. While copies from the fastbins,
251smallbins, and regular bins are bounded and predictable due to the bin
252sizes, copies from the unsorted bin are not bounded, and incur
253additional time penalties as they need to be sorted as they're
254scanned. To make scanning the unsorted list more predictable and
255bounded, the user may set this tunable to limit the number of chunks
256that are scanned from the unsorted list while searching for chunks to
257pre-fill the per-thread cache with. The default, or when set to zero,
258is no limit.
be8aa923 259@end deftp
d5c3fafc 260
c48d92b4 261@deftp Tunable glibc.malloc.mxfast
bdc674d9 262One of the optimizations @code{malloc} uses is to maintain a series of ``fast
c48d92b4
DD
263bins'' that hold chunks up to a specific size. The default and
264maximum size which may be held this way is 80 bytes on 32-bit systems
265or 160 bytes on 64-bit systems. Applications which value size over
266speed may choose to reduce the size of requests which are serviced
267from fast bins with this tunable. Note that the value specified
bdc674d9 268includes @code{malloc}'s internal overhead, which is normally the size of one
c48d92b4
DD
269pointer, so add 4 on 32-bit systems or 8 on 64-bit systems to the size
270passed to @code{malloc} for the largest bin size to enable.
271@end deftp
272
0c7b002f
SN
273@node Dynamic Linking Tunables
274@section Dynamic Linking Tunables
275@cindex dynamic linking tunables
276@cindex rtld tunables
277
278@deftp {Tunable namespace} glibc.rtld
279Dynamic linker behavior can be modified by setting the
280following tunables in the @code{rtld} namespace:
281@end deftp
282
283@deftp Tunable glibc.rtld.nns
284Sets the number of supported dynamic link namespaces (see @code{dlmopen}).
285Currently this limit can be set between 1 and 16 inclusive, the default is 4.
286Each link namespace consumes some memory in all thread, and thus raising the
287limit will increase the amount of memory each thread uses. Raising the limit
17796419
SN
288is useful when your application uses more than 4 dynamic link namespaces as
289created by @code{dlmopen} with an lmid argument of @code{LM_ID_NEWLM}.
290Dynamic linker audit modules are loaded in their own dynamic link namespaces,
291but they are not accounted for in @code{glibc.rtld.nns}. They implicitly
292increase the per-thread memory usage as necessary, so this tunable does
293not need to be changed to allow many audit modules e.g. via @env{LD_AUDIT}.
0c7b002f
SN
294@end deftp
295
ffb17e7b
SN
296@deftp Tunable glibc.rtld.optional_static_tls
297Sets the amount of surplus static TLS in bytes to allocate at program
298startup. Every thread created allocates this amount of specified surplus
299static TLS. This is a minimum value and additional space may be allocated
300for internal purposes including alignment. Optional static TLS is used for
301optimizing dynamic TLS access for platforms that support such optimizations
302e.g. TLS descriptors or optimized TLS access for POWER (@code{DT_PPC64_OPT}
303and @code{DT_PPC_OPT}). In order to make the best use of such optimizations
304the value should be as many bytes as would be required to hold all TLS
305variables in all dynamic loaded shared libraries. The value cannot be known
306by the dynamic loader because it doesn't know the expected set of shared
307libraries which will be loaded. The existing static TLS space cannot be
308changed once allocated at process startup. The default allocation of
309optional static TLS is 512 bytes and is allocated in every thread.
310@end deftp
311
15a0c573
CLT
312@deftp Tunable glibc.rtld.dynamic_sort
313Sets the algorithm to use for DSO sorting, valid values are @samp{1} and
314@samp{2}. For value of @samp{1}, an older O(n^3) algorithm is used, which is
315long time tested, but may have performance issues when dependencies between
316shared objects contain cycles due to circular dependencies. When set to the
317value of @samp{2}, a different algorithm is used, which implements a
318topological sort through depth-first search, and does not exhibit the
319performance issues of @samp{1}.
320
0884724a 321The default value of this tunable is @samp{2}.
15a0c573 322@end deftp
ffb17e7b 323
07ed18d2
RA
324@node Elision Tunables
325@section Elision Tunables
326@cindex elision tunables
327@cindex tunables, elision
328
329@deftp {Tunable namespace} glibc.elision
330Contended locks are usually slow and can lead to performance and scalability
331issues in multithread code. Lock elision will use memory transactions to under
332certain conditions, to elide locks and improve performance.
333Elision behavior can be modified by setting the following tunables in
334the @code{elision} namespace:
335@end deftp
336
337@deftp Tunable glibc.elision.enable
338The @code{glibc.elision.enable} tunable enables lock elision if the feature is
339supported by the hardware. If elision is not supported by the hardware this
340tunable has no effect.
341
342Elision tunables are supported for 64-bit Intel, IBM POWER, and z System
343architectures.
344@end deftp
345
346@deftp Tunable glibc.elision.skip_lock_busy
347The @code{glibc.elision.skip_lock_busy} tunable sets how many times to use a
348non-transactional lock after a transactional failure has occurred because the
349lock is already acquired. Expressed in number of lock acquisition attempts.
350
351The default value of this tunable is @samp{3}.
352@end deftp
353
354@deftp Tunable glibc.elision.skip_lock_internal_abort
355The @code{glibc.elision.skip_lock_internal_abort} tunable sets how many times
356the thread should avoid using elision if a transaction aborted for any reason
357other than a different thread's memory accesses. Expressed in number of lock
358acquisition attempts.
359
360The default value of this tunable is @samp{3}.
361@end deftp
362
363@deftp Tunable glibc.elision.skip_lock_after_retries
364The @code{glibc.elision.skip_lock_after_retries} tunable sets how many times
365to try to elide a lock with transactions, that only failed due to a different
366thread's memory accesses, before falling back to regular lock.
367Expressed in number of lock elision attempts.
368
369This tunable is supported only on IBM POWER, and z System architectures.
370
371The default value of this tunable is @samp{3}.
372@end deftp
373
374@deftp Tunable glibc.elision.tries
375The @code{glibc.elision.tries} sets how many times to retry elision if there is
376chance for the transaction to finish execution e.g., it wasn't
377aborted due to the lock being already acquired. If elision is not supported
378by the hardware this tunable is set to @samp{0} to avoid retries.
379
380The default value of this tunable is @samp{3}.
381@end deftp
382
383@deftp Tunable glibc.elision.skip_trylock_internal_abort
384The @code{glibc.elision.skip_trylock_internal_abort} tunable sets how many
385times the thread should avoid trying the lock if a transaction aborted due to
386reasons other than a different thread's memory accesses. Expressed in number
387of try lock attempts.
388
389The default value of this tunable is @samp{3}.
390@end deftp
391
6310e6be
KW
392@node POSIX Thread Tunables
393@section POSIX Thread Tunables
394@cindex pthread mutex tunables
395@cindex thread mutex tunables
396@cindex mutex tunables
397@cindex tunables thread mutex
398
399@deftp {Tunable namespace} glibc.pthread
400The behavior of POSIX threads can be tuned to gain performance improvements
401according to specific hardware capabilities and workload characteristics by
402setting the following tunables in the @code{pthread} namespace:
403@end deftp
404
405@deftp Tunable glibc.pthread.mutex_spin_count
406The @code{glibc.pthread.mutex_spin_count} tunable sets the maximum number of times
407a thread should spin on the lock before calling into the kernel to block.
408Adaptive spin is used for mutexes initialized with the
409@code{PTHREAD_MUTEX_ADAPTIVE_NP} GNU extension. It affects both
410@code{pthread_mutex_lock} and @code{pthread_mutex_timedlock}.
411
412The thread spins until either the maximum spin count is reached or the lock
413is acquired.
414
415The default value of this tunable is @samp{100}.
416@end deftp
417
dd45734e
FW
418@deftp Tunable glibc.pthread.stack_cache_size
419This tunable configures the maximum size of the stack cache. Once the
420stack cache exceeds this size, unused thread stacks are returned to
421the kernel, to bring the cache size below this limit.
422
423The value is measured in bytes. The default is @samp{41943040}
424(fourty mibibytes).
425@end deftp
426
e3e58982
FW
427@deftp Tunable glibc.pthread.rseq
428The @code{glibc.pthread.rseq} tunable can be set to @samp{0}, to disable
429restartable sequences support in @theglibc{}. This enables applications
430to perform direct restartable sequence registration with the kernel.
431The default is @samp{1}, which means that @theglibc{} performs
432registration on behalf of the application.
433
434Restartable sequences are a Linux-specific extension.
435@end deftp
436
ea9b0ecb
SP
437@node Hardware Capability Tunables
438@section Hardware Capability Tunables
439@cindex hardware capability tunables
440@cindex hwcap tunables
441@cindex tunables, hwcap
03feacb5
L
442@cindex hwcaps tunables
443@cindex tunables, hwcaps
905947c3
L
444@cindex data_cache_size tunables
445@cindex tunables, data_cache_size
446@cindex shared_cache_size tunables
447@cindex tunables, shared_cache_size
448@cindex non_temporal_threshold tunables
449@cindex tunables, non_temporal_threshold
ea9b0ecb 450
dce452dc 451@deftp {Tunable namespace} glibc.cpu
ea9b0ecb 452Behavior of @theglibc{} can be tuned to assume specific hardware capabilities
dce452dc 453by setting the following tunables in the @code{cpu} namespace:
ea9b0ecb
SP
454@end deftp
455
dce452dc 456@deftp Tunable glibc.cpu.hwcap_mask
ea9b0ecb
SP
457This tunable supersedes the @env{LD_HWCAP_MASK} environment variable and is
458identical in features.
459
28c3f14f 460The @code{AT_HWCAP} key in the Auxiliary Vector specifies instruction set
ea9b0ecb 461extensions available in the processor at runtime for some architectures. The
dce452dc 462@code{glibc.cpu.hwcap_mask} tunable allows the user to mask out those
ea9b0ecb
SP
463capabilities at runtime, thus disabling use of those extensions.
464@end deftp
905947c3 465
dce452dc
SP
466@deftp Tunable glibc.cpu.hwcaps
467The @code{glibc.cpu.hwcaps=-xxx,yyy,-zzz...} tunable allows the user to
905947c3
L
468enable CPU/ARCH feature @code{yyy}, disable CPU/ARCH feature @code{xxx}
469and @code{zzz} where the feature name is case-sensitive and has to match
470the ones in @code{sysdeps/x86/cpu-features.h}.
471
472This tunable is specific to i386 and x86-64.
473@end deftp
474
dce452dc
SP
475@deftp Tunable glibc.cpu.cached_memopt
476The @code{glibc.cpu.cached_memopt=[0|1]} tunable allows the user to
c9cd7b0c
AZ
477enable optimizations recommended for cacheable memory. If set to
478@code{1}, @theglibc{} assumes that the process memory image consists
479of cacheable (non-device) memory only. The default, @code{0},
480indicates that the process may use device memory.
481
482This tunable is specific to powerpc, powerpc64 and powerpc64le.
483@end deftp
484
dce452dc
SP
485@deftp Tunable glibc.cpu.name
486The @code{glibc.cpu.name=xxx} tunable allows the user to tell @theglibc{} to
28cfa3a4 487assume that the CPU is @code{xxx} where xxx may have one of these values:
9c9ec581 488@code{generic}, @code{falkor}, @code{thunderxt88}, @code{thunderx2t99},
fa527f34
NT
489@code{thunderx2t99p1}, @code{ares}, @code{emag}, @code{kunpeng},
490@code{a64fx}.
28cfa3a4
SP
491
492This tunable is specific to aarch64.
493@end deftp
494
dce452dc
SP
495@deftp Tunable glibc.cpu.x86_data_cache_size
496The @code{glibc.cpu.x86_data_cache_size} tunable allows the user to set
905947c3
L
497data cache size in bytes for use in memory and string routines.
498
499This tunable is specific to i386 and x86-64.
500@end deftp
501
dce452dc
SP
502@deftp Tunable glibc.cpu.x86_shared_cache_size
503The @code{glibc.cpu.x86_shared_cache_size} tunable allows the user to
905947c3
L
504set shared cache size in bytes for use in memory and string routines.
505@end deftp
506
dce452dc
SP
507@deftp Tunable glibc.cpu.x86_non_temporal_threshold
508The @code{glibc.cpu.x86_non_temporal_threshold} tunable allows the user
d3c57027
PM
509to set threshold in bytes for non temporal store. Non temporal stores
510give a hint to the hardware to move data directly to memory without
511displacing other data from the cache. This tunable is used by some
512platforms to determine when to use non temporal stores in operations
513like memmove and memcpy.
905947c3
L
514
515This tunable is specific to i386 and x86-64.
516@end deftp
6d90776d 517
3f4b61a0
L
518@deftp Tunable glibc.cpu.x86_rep_movsb_threshold
519The @code{glibc.cpu.x86_rep_movsb_threshold} tunable allows the user to
520set threshold in bytes to start using "rep movsb". The value must be
521greater than zero, and currently defaults to 2048 bytes.
522
523This tunable is specific to i386 and x86-64.
524@end deftp
525
526@deftp Tunable glibc.cpu.x86_rep_stosb_threshold
527The @code{glibc.cpu.x86_rep_stosb_threshold} tunable allows the user to
528set threshold in bytes to start using "rep stosb". The value must be
529greater than zero, and currently defaults to 2048 bytes.
530
531This tunable is specific to i386 and x86-64.
532@end deftp
533
dce452dc
SP
534@deftp Tunable glibc.cpu.x86_ibt
535The @code{glibc.cpu.x86_ibt} tunable allows the user to control how
6d90776d
L
536indirect branch tracking (IBT) should be enabled. Accepted values are
537@code{on}, @code{off}, and @code{permissive}. @code{on} always turns
538on IBT regardless of whether IBT is enabled in the executable and its
539dependent shared libraries. @code{off} always turns off IBT regardless
540of whether IBT is enabled in the executable and its dependent shared
541libraries. @code{permissive} is the same as the default which disables
542IBT on non-CET executables and shared libraries.
543
544This tunable is specific to i386 and x86-64.
545@end deftp
546
dce452dc
SP
547@deftp Tunable glibc.cpu.x86_shstk
548The @code{glibc.cpu.x86_shstk} tunable allows the user to control how
6d90776d
L
549the shadow stack (SHSTK) should be enabled. Accepted values are
550@code{on}, @code{off}, and @code{permissive}. @code{on} always turns on
551SHSTK regardless of whether SHSTK is enabled in the executable and its
552dependent shared libraries. @code{off} always turns off SHSTK regardless
553of whether SHSTK is enabled in the executable and its dependent shared
554libraries. @code{permissive} changes how dlopen works on non-CET shared
555libraries. By default, when SHSTK is enabled, dlopening a non-CET shared
556library returns an error. With @code{permissive}, it turns off SHSTK
557instead.
558
559This tunable is specific to i386 and x86-64.
560@end deftp
26450d04
RE
561
562@node Memory Related Tunables
563@section Memory Related Tunables
564@cindex memory related tunables
565
566@deftp {Tunable namespace} glibc.mem
567This tunable namespace supports operations that affect the way @theglibc{}
568and the process manage memory.
569@end deftp
570
571@deftp Tunable glibc.mem.tagging
572If the hardware supports memory tagging, this tunable can be used to
573control the way @theglibc{} uses this feature. At present this is only
574supported on AArch64 systems with the MTE extention; it is ignored for
575all other systems.
576
577This tunable takes a value between 0 and 255 and acts as a bitmask
578that enables various capabilities.
579
bdc674d9
PE
580Bit 0 (the least significant bit) causes the @code{malloc}
581subsystem to allocate
26450d04
RE
582tagged memory, with each allocation being assigned a random tag.
583
584Bit 1 enables precise faulting mode for tag violations on systems that
585support deferred tag violation reporting. This may cause programs
586to run more slowly.
587
588Other bits are currently reserved.
589
590@Theglibc{} startup code will automatically enable memory tagging
591support in the kernel if this tunable has any non-zero value.
592
593The default value is @samp{0}, which disables all memory tagging.
594@end deftp