]> git.proxmox.com Git - mirror_zfs.git/blame - man/man5/spl-module-parameters.5
Add IMPLY() and EQUIV() macros
[mirror_zfs.git] / man / man5 / spl-module-parameters.5
CommitLineData
30607d9b
TF
1'\" te
2.\"
3.\" Copyright 2013 Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
4.\"
5.TH SPL-MODULE-PARAMETERS 5 "Nov 18, 2013"
6.SH NAME
7spl\-module\-parameters \- SPL module parameters
8.SH DESCRIPTION
9.sp
10.LP
11Description of the different parameters to the SPL module.
12
13.SS "Module parameters"
14.sp
15.LP
16
17.sp
18.ne 2
19.na
b1c3ae48 20\fBspl_kmem_cache_expire\fR (uint)
30607d9b
TF
21.ad
22.RS 12n
b1c3ae48
BB
23Cache expiration is part of default Illumos cache behavior. The idea is
24that objects in magazines which have not been recently accessed should be
25returned to the slabs periodically. This is known as cache aging and
26when enabled objects will be typically returned after 15 seconds.
27.sp
28On the other hand Linux slabs are designed to never move objects back to
29the slabs unless there is memory pressure. This is possible because under
30Linux the cache will be notified when memory is low and objects can be
31released.
32.sp
33By default only the Linux method is enabled. It has been shown to improve
34responsiveness on low memory systems and not negatively impact the performance
35of systems with more memory. This policy may be changed by setting the
36\fBspl_kmem_cache_expire\fR bit mask as follows, both policies may be enabled
37concurrently.
38.sp
390x01 - Aging (Illumos), 0x02 - Low memory (Linux)
30607d9b 40.sp
b1c3ae48 41Default value: \fB0x02\fR
30607d9b
TF
42.RE
43
44.sp
45.ne 2
46.na
b1c3ae48 47\fBspl_kmem_cache_reclaim\fR (uint)
30607d9b
TF
48.ad
49.RS 12n
b1c3ae48
BB
50When this is set it prevents Linux from being able to rapidly reclaim all the
51memory held by the kmem caches. This may be useful in circumstances where
52it's preferable that Linux reclaim memory from some other subsystem first.
53Setting this will increase the likelihood out of memory events on a memory
54constrained system.
30607d9b 55.sp
b1c3ae48 56Default value: \fB0\fR
30607d9b
TF
57.RE
58
59.sp
60.ne 2
61.na
b1c3ae48 62\fBspl_kmem_cache_obj_per_slab\fR (uint)
30607d9b
TF
63.ad
64.RS 12n
b1c3ae48
BB
65The preferred number of objects per slab in the cache. In general, a larger
66value will increase the caches memory footprint while decreasing the time
67required to perform an allocation. Conversely, a smaller value will minimize
68the footprint and improve cache reclaim time but individual allocations may
69take longer.
30607d9b 70.sp
3018bffa 71Default value: \fB8\fR
30607d9b
TF
72.RE
73
74.sp
75.ne 2
76.na
b1c3ae48 77\fBspl_kmem_cache_obj_per_slab_min\fR (uint)
30607d9b
TF
78.ad
79.RS 12n
b1c3ae48
BB
80The minimum number of objects allowed per slab. Normally slabs will contain
81\fBspl_kmem_cache_obj_per_slab\fR objects but for caches that contain very
82large objects it's desirable to only have a few, or even just one, object per
83slab.
30607d9b 84.sp
b1c3ae48 85Default value: \fB1\fR
30607d9b
TF
86.RE
87
88.sp
89.ne 2
90.na
b1c3ae48 91\fBspl_kmem_cache_max_size\fR (uint)
30607d9b
TF
92.ad
93.RS 12n
b1c3ae48
BB
94The maximum size of a kmem cache slab in MiB. This effectively limits
95the maximum cache object size to \fBspl_kmem_cache_max_size\fR /
96\fBspl_kmem_cache_obj_per_slab\fR. Caches may not be created with
97object sized larger than this limit.
30607d9b 98.sp
3018bffa 99Default value: \fB32 (64-bit) or 4 (32-bit)\fR
30607d9b
TF
100.RE
101
102.sp
103.ne 2
104.na
b1c3ae48 105\fBspl_kmem_cache_slab_limit\fR (uint)
30607d9b
TF
106.ad
107.RS 12n
b1c3ae48
BB
108For small objects the Linux slab allocator should be used to make the most
109efficient use of the memory. However, large objects are not supported by
110the Linux slab and therefore the SPL implementation is preferred. This
111value is used to determine the cutoff between a small and large object.
112.sp
113Objects of \fBspl_kmem_cache_slab_limit\fR or smaller will be allocated
114using the Linux slab allocator, large objects use the SPL allocator. A
115cutoff of 16K was determined to be optimal for architectures using 4K pages.
30607d9b 116.sp
b1c3ae48
BB
117Default value: \fB16,384\fR
118.RE
119
120.sp
121.ne 2
122.na
123\fBspl_kmem_cache_kmem_limit\fR (uint)
124.ad
125.RS 12n
126Depending on the size of a cache object it may be backed by kmalloc()'d
127or vmalloc()'d memory. This is because the size of the required allocation
128greatly impacts the best way to allocate the memory.
129.sp
130When objects are small and only a small number of memory pages need to be
131allocated, ideally just one, then kmalloc() is very efficient. However,
132when allocating multiple pages with kmalloc() it gets increasingly expensive
133because the pages must be physically contiguous.
134.sp
135For this reason we shift to vmalloc() for slabs of large objects which
136which removes the need for contiguous pages. We cannot use vmalloc() in
137all cases because there is significant locking overhead involved. This
138function takes a single global lock over the entire virtual address range
139which serializes all allocations. Using slightly different allocation
140functions for small and large objects allows us to handle a wide range of
141object sizes.
142.sh
143The \fBspl_kmem_cache_kmem_limit\fR value is used to determine this cutoff
144size. One quarter the PAGE_SIZE is used as the default value because
145\fBspl_kmem_cache_obj_per_slab\fR defaults to 16. This means that at
146most we will need to allocate four contiguous pages.
147.sp
148Default value: \fBPAGE_SIZE/4\fR
30607d9b
TF
149.RE
150
c3eabc75
BB
151.sp
152.ne 2
153.na
154\fBspl_kmem_alloc_warn\fR (uint)
155.ad
156.RS 12n
157As a general rule kmem_alloc() allocations should be small, preferably
158just a few pages since they must by physically contiguous. Therefore, a
159rate limited warning will be printed to the console for any kmem_alloc()
160which exceeds a reasonable threshold.
b1c3ae48 161.sp
c3eabc75
BB
162The default warning threshold is set to eight pages but capped at 32K to
163accommodate systems using large pages. This value was selected to be small
164enough to ensure the largest allocations are quickly noticed and fixed.
165But large enough to avoid logging any warnings when a allocation size is
166larger than optimal but not a serious concern. Since this value is tunable,
167developers are encouraged to set it lower when testing so any new largish
168allocations are quickly caught. These warnings may be disabled by setting
169the threshold to zero.
170.sp
b1c3ae48 171Default value: \fB32,768\fR
c3eabc75
BB
172.RE
173
174.sp
175.ne 2
176.na
177\fBspl_kmem_alloc_max\fR (uint)
178.ad
179.RS 12n
180Large kmem_alloc() allocations will fail if they exceed KMALLOC_MAX_SIZE.
181Allocations which are marginally smaller than this limit may succeed but
182should still be avoided due to the expense of locating a contiguous range
183of free pages. Therefore, a maximum kmem size with reasonable safely
184margin of 4x is set. Kmem_alloc() allocations larger than this maximum
185will quickly fail. Vmem_alloc() allocations less than or equal to this
186value will use kmalloc(), but shift to vmalloc() when exceeding this value.
187.sp
b1c3ae48 188Default value: \fBKMALLOC_MAX_SIZE/4\fR
c3eabc75
BB
189.RE
190
1a204968
BB
191.sp
192.ne 2
193.na
194\fBspl_kmem_cache_magazine_size\fR (uint)
195.ad
196.RS 12n
197Cache magazines are an optimization designed to minimize the cost of
198allocating memory. They do this by keeping a per-cpu cache of recently
199freed objects, which can then be reallocated without taking a lock. This
200can improve performance on highly contended caches. However, because
201objects in magazines will prevent otherwise empty slabs from being
202immediately released this may not be ideal for low memory machines.
203.sp
204For this reason \fBspl_kmem_cache_magazine_size\fR can be used to set a
205maximum magazine size. When this value is set to 0 the magazine size will
206be automatically determined based on the object size. Otherwise magazines
207will be limited to 2-256 objects per magazine (i.e per cpu). Magazines
208may never be entirely disabled in this implementation.
209.sp
b1c3ae48 210Default value: \fB0\fR
1a204968
BB
211.RE
212
30607d9b
TF
213.sp
214.ne 2
215.na
216\fBspl_hostid\fR (ulong)
217.ad
218.RS 12n
b1c3ae48
BB
219The system hostid, when set this can be used to uniquely identify a system.
220By default this value is set to zero which indicates the hostid is disabled.
221It can be explicitly enabled by placing a unique non-zero value in
222\fB/etc/hostid/\fR.
30607d9b 223.sp
b1c3ae48 224Default value: \fB0\fR
30607d9b
TF
225.RE
226
227.sp
228.ne 2
229.na
230\fBspl_hostid_path\fR (charp)
231.ad
232.RS 12n
b1c3ae48
BB
233The expected path to locate the system hostid when specified. This value
234may be overridden for non-standard configurations.
30607d9b 235.sp
b1c3ae48 236Default value: \fB/etc/hostid\fR
30607d9b
TF
237.RE
238
703371d8
AV
239.sp
240.ne 2
241.na
242\fBspl_taskq_thread_bind\fR (int)
243.ad
244.RS 12n
b1c3ae48
BB
245Bind taskq threads to specific CPUs. When enabled all taskq threads will
246be distributed evenly over the available CPUs. By default, this behavior
247is disabled to allow the Linux scheduler the maximum flexibility to determine
248where a thread should run.
703371d8 249.sp
b1c3ae48 250Default value: \fB0\fR
703371d8 251.RE