1.\" SPDX-License-Identifier: CDDL-1.0 2.\" 3.\" The contents of this file are subject to the terms of the Common Development 4.\" and Distribution License (the "License"). You may not use this file except 5.\" in compliance with the License. You can obtain a copy of the license at 6.\" usr/src/OPENSOLARIS.LICENSE or https://opensource.org/licenses/CDDL-1.0. 7.\" 8.\" See the License for the specific language governing permissions and 9.\" limitations under the License. When distributing Covered Code, include this 10.\" CDDL HEADER in each file and include the License file at 11.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this 12.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your 13.\" own identifying information: 14.\" Portions Copyright [yyyy] [name of copyright owner] 15.\" 16.\" Copyright 2013 Turbo Fredriksson <turbo@bayour.com>. All rights reserved. 17.\" 18.Dd August 24, 2020 19.Dt SPL 4 20.Os 21. 22.Sh NAME 23.Nm spl 24.Nd parameters of the SPL kernel module 25. 26.Sh DESCRIPTION 27.Bl -tag -width Ds 28.It Sy spl_kmem_cache_kmem_threads Ns = Ns Sy 4 Pq uint 29The number of threads created for the spl_kmem_cache task queue. 30This task queue is responsible for allocating new slabs 31for use by the kmem caches. 32For the majority of systems and workloads only a small number of threads are 33required. 34. 35.It Sy spl_kmem_cache_obj_per_slab Ns = Ns Sy 8 Pq uint 36The preferred number of objects per slab in the cache. 37In general, a larger value will increase the caches memory footprint 38while decreasing the time required to perform an allocation. 39Conversely, a smaller value will minimize the footprint 40and improve cache reclaim time but individual allocations may take longer. 41. 42.It Sy spl_kmem_cache_max_size Ns = Ns Sy 32 Po 64-bit Pc or Sy 4 Po 32-bit Pc Pq uint 43The maximum size of a kmem cache slab in MiB. 44This effectively limits the maximum cache object size to 45.Sy spl_kmem_cache_max_size Ns / Ns Sy spl_kmem_cache_obj_per_slab . 46.Pp 47Caches may not be created with 48object sized larger than this limit. 49. 50.It Sy spl_kmem_cache_slab_limit Ns = Ns Sy 16384 Pq uint 51For small objects the Linux slab allocator should be used to make the most 52efficient use of the memory. 53However, large objects are not supported by 54the Linux slab and therefore the SPL implementation is preferred. 55This value is used to determine the cutoff between a small and large object. 56.Pp 57Objects of size 58.Sy spl_kmem_cache_slab_limit 59or smaller will be allocated using the Linux slab allocator, 60large objects use the SPL allocator. 61A cutoff of 16K was determined to be optimal for architectures using 4K pages. 62. 63.It Sy spl_kmem_alloc_warn Ns = Ns Sy 32768 Pq uint 64As a general rule 65.Fn kmem_alloc 66allocations should be small, 67preferably just a few pages, since they must by physically contiguous. 68Therefore, a rate limited warning will be printed to the console for any 69.Fn kmem_alloc 70which exceeds a reasonable threshold. 71.Pp 72The default warning threshold is set to eight pages but capped at 32K to 73accommodate systems using large pages. 74This value was selected to be small enough to ensure 75the largest allocations are quickly noticed and fixed. 76But large enough to avoid logging any warnings when a allocation size is 77larger than optimal but not a serious concern. 78Since this value is tunable, developers are encouraged to set it lower 79when testing so any new largish allocations are quickly caught. 80These warnings may be disabled by setting the threshold to zero. 81. 82.It Sy spl_kmem_alloc_max Ns = Ns Sy KMALLOC_MAX_SIZE Ns / Ns Sy 4 Pq uint 83Large 84.Fn kmem_alloc 85allocations will fail if they exceed 86.Sy KMALLOC_MAX_SIZE . 87Allocations which are marginally smaller than this limit may succeed but 88should still be avoided due to the expense of locating a contiguous range 89of free pages. 90Therefore, a maximum kmem size with reasonable safely margin of 4x is set. 91.Fn kmem_alloc 92allocations larger than this maximum will quickly fail. 93.Fn vmem_alloc 94allocations less than or equal to this value will use 95.Fn kmalloc , 96but shift to 97.Fn vmalloc 98when exceeding this value. 99. 100.It Sy spl_kmem_cache_magazine_size Ns = Ns Sy 0 Pq uint 101Cache magazines are an optimization designed to minimize the cost of 102allocating memory. 103They do this by keeping a per-CPU cache of recently 104freed objects, which can then be reallocated without taking a lock. 105This can improve performance on highly contended caches. 106However, because objects in magazines will prevent otherwise empty slabs 107from being immediately released this may not be ideal for low memory machines. 108.Pp 109For this reason, 110.Sy spl_kmem_cache_magazine_size 111can be used to set a maximum magazine size. 112When this value is set to 0 the magazine size will 113be automatically determined based on the object size. 114Otherwise magazines will be limited to 2-256 objects per magazine (i.e. per 115CPU). Magazines may never be entirely disabled in this implementation. 116. 117.It Sy spl_hostid Ns = Ns Sy 0 Pq ulong 118The system hostid, when set this can be used to uniquely identify a system. 119By default this value is set to zero which indicates the hostid is disabled. 120It can be explicitly enabled by placing a unique non-zero value in 121.Pa /etc/hostid . 122. 123.It Sy spl_hostid_path Ns = Ns Pa /etc/hostid Pq charp 124The expected path to locate the system hostid when specified. 125This value may be overridden for non-standard configurations. 126. 127.It Sy spl_panic_halt Ns = Ns Sy 0 Pq uint 128Cause a kernel panic on assertion failures. 129When not enabled, the thread is halted to facilitate further debugging. 130.Pp 131Set to a non-zero value to enable. 132. 133.It Sy spl_taskq_kick Ns = Ns Sy 0 Pq uint 134Kick stuck taskq to spawn threads. 135When writing a non-zero value to it, it will scan all the taskqs. 136If any of them have a pending task more than 5 seconds old, 137it will kick it to spawn more threads. 138This can be used if you find a rare 139deadlock occurs because one or more taskqs didn't spawn a thread when it should. 140. 141.It Sy spl_taskq_thread_bind Ns = Ns Sy 0 Pq int 142Bind taskq threads to specific CPUs. 143When enabled all taskq threads will be distributed evenly 144across the available CPUs. 145By default, this behavior is disabled to allow the Linux scheduler 146the maximum flexibility to determine where a thread should run. 147. 148.It Sy spl_taskq_thread_dynamic Ns = Ns Sy 1 Pq int 149Allow dynamic taskqs. 150When enabled taskqs which set the 151.Sy TASKQ_DYNAMIC 152flag will by default create only a single thread. 153New threads will be created on demand up to a maximum allowed number 154to facilitate the completion of outstanding tasks. 155Threads which are no longer needed will be promptly destroyed. 156By default this behavior is enabled but it can be disabled to 157aid performance analysis or troubleshooting. 158. 159.It Sy spl_taskq_thread_priority Ns = Ns Sy 1 Pq int 160Allow newly created taskq threads to set a non-default scheduler priority. 161When enabled, the priority specified when a taskq is created will be applied 162to all threads created by that taskq. 163When disabled all threads will use the default Linux kernel thread priority. 164By default, this behavior is enabled. 165. 166.It Sy spl_taskq_thread_sequential Ns = Ns Sy 4 Pq int 167The number of items a taskq worker thread must handle without interruption 168before requesting a new worker thread be spawned. 169This is used to control 170how quickly taskqs ramp up the number of threads processing the queue. 171Because Linux thread creation and destruction are relatively inexpensive a 172small default value has been selected. 173This means that normally threads will be created aggressively which is 174desirable. 175Increasing this value will 176result in a slower thread creation rate which may be preferable for some 177configurations. 178. 179.It Sy spl_taskq_thread_timeout_ms Ns = Ns Sy 5000 Pq uint 180Minimum idle threads exit interval for dynamic taskqs. 181Smaller values allow idle threads exit more often and potentially be 182respawned again on demand, causing more churn. 183.El 184