]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright (c) 2001 Andreas Dilger (adilger@turbolinux.com) |
9d224152 | 2 | .\" and Copyright (c) 2017 Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da | 3 | .\" |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
fea681da | 25 | .\" |
4b8c67d9 | 26 | .TH SLABINFO 5 2017-09-15 "" "Linux Programmer's Manual" |
fea681da | 27 | .SH NAME |
7e1c8de0 | 28 | slabinfo \- kernel slab allocator statistics |
fea681da MK |
29 | .SH SYNOPSIS |
30 | .B cat /proc/slabinfo | |
31 | .SH DESCRIPTION | |
32 | Frequently used objects in the Linux kernel | |
33 | (buffer heads, inodes, dentries, etc.) | |
c13182ef MK |
34 | have their own cache. |
35 | The file | |
fea681da | 36 | .I /proc/slabinfo |
27e78df1 MK |
37 | gives statistics on these caches. |
38 | The following (edited) output shows an example of the | |
39 | contents of this file: | |
dd3568a1 | 40 | .PP |
27e78df1 | 41 | .in 0 |
9c40f2b9 | 42 | .EX |
27e78df1 MK |
43 | $ \fBsudo cat /proc/slabinfo\fP |
44 | slabinfo - version: 2.1 | |
45 | # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> ... | |
46 | sigqueue 100 100 160 25 1 : tunables 0 0 0 : slabdata 4 4 0 | |
47 | sighand_cache 355 405 2112 15 8 : tunables 0 0 0 : slabdata 27 27 0 | |
48 | kmalloc-8192 96 96 8192 4 8 : tunables 0 0 0 : slabdata 24 24 0 | |
fea681da | 49 | \&... |
b8302363 | 50 | .EE |
a6e2f128 | 51 | .in |
dd3568a1 | 52 | .PP |
27e78df1 MK |
53 | The first line of output includes a version number, |
54 | which allows an application that is reading the file to handle changes | |
55 | in the file format. | |
56 | (See VERSIONS, below.) | |
57 | The next line lists the names of the columns in the remaining lines. | |
eabf3ae5 | 58 | .PP |
27e78df1 MK |
59 | Each of the remaining lines displays information about a specified cache. |
60 | Following the cache name, | |
61 | the output shown in each line shows three components for each cache: | |
62 | .IP * 3 | |
63 | statistics | |
64 | .IP * | |
65 | tunables | |
66 | .IP * | |
67 | slabdata | |
68 | .PP | |
69 | The statistics are as follows: | |
70 | .TP | |
71 | .I active_objs | |
72 | The number of objects that are currently active (i.e., in use). | |
73 | .TP | |
74 | .I num_objs | |
75 | The total number of allocated objects | |
76 | (i.e., objects that are both in use and not in use). | |
77 | .TP | |
78 | .I objsize | |
79 | The size of objects in this slab, in bytes. | |
80 | .TP | |
81 | .I objperslab | |
82 | The number of objects stored in each slab. | |
83 | .TP | |
84 | .I pagesperslab | |
85 | The number of pages allocated for each slab. | |
86 | .PP | |
87 | The | |
88 | .I tunables | |
89 | entries in each line show tunable parameters for the corresponding cache. | |
90 | When using the default SLUB allocator, there are no tunables, the | |
91 | .I /proc/slabinfo | |
fa6cebc8 | 92 | file is not writable, and the value 0 is shown in these fields. |
27e78df1 MK |
93 | When using the older SLAB allocator, |
94 | the tunables for a particular cache can be set by writing | |
95 | lines of the following form to | |
96 | .IR /proc/slabinfo : | |
eabf3ae5 | 97 | .PP |
9c40f2b9 MK |
98 | .in +4n |
99 | .EX | |
100 | # \fBecho 'name limit batchcount sharedfactor' > /proc/slabinfo\fP | |
101 | .EE | |
102 | .in | |
eabf3ae5 | 103 | .PP |
27e78df1 MK |
104 | Here, |
105 | .I name | |
106 | is the cache name, and | |
107 | .IR limit , | |
108 | .IR batchcount , | |
109 | and | |
110 | .IR sharedfactor | |
111 | are integers defining new values for the corresponding tunables. | |
35737fdb MK |
112 | The |
113 | .I limit | |
114 | value should be a positive value, | |
115 | .I batchcount | |
116 | should be a positive value that is less than or equal to | |
117 | .IR limit , | |
118 | and | |
119 | .I sharedfactor | |
120 | should be nonnegative. | |
121 | If any of the specified values is invalid, | |
122 | the cache settings are left unchanged. | |
eabf3ae5 | 123 | .PP |
27e78df1 MK |
124 | The |
125 | .I tunables | |
126 | entries in each line contain the following fields: | |
127 | .TP | |
128 | .I limit | |
129 | The maximum number of objects that will be cached. | |
130 | .\" https://lwn.net/Articles/56360/ | |
131 | .\" This is the limit on the number of free objects that can be stored | |
132 | .\" in the per-CPU free list for this slab cache. | |
133 | .TP | |
134 | .I batchcount | |
2f476521 MK |
135 | On SMP systems, this specifies the number of objects to transfer at one time |
136 | when refilling the available object list. | |
27e78df1 MK |
137 | .\" https://lwn.net/Articles/56360/ |
138 | .\" On SMP systems, when we refill the available object list, instead | |
139 | .\" of doing one object at a time, we do batch-count objects at a time. | |
140 | .TP | |
141 | .I sharedfactor | |
142 | [To be documented] | |
99cf1681 | 143 | .\" |
27e78df1 MK |
144 | .PP |
145 | The | |
146 | .I slabdata | |
147 | entries in each line contain the following fields: | |
148 | .TP | |
149 | .I active_slabs | |
150 | The number of active slabs. | |
151 | .TP | |
152 | .I nums_slabs | |
153 | The total number of slabs. | |
154 | .TP | |
155 | .I sharedavail | |
156 | [To be documented] | |
157 | .PP | |
fea681da | 158 | Note that because of object alignment and slab cache overhead, |
c13182ef | 159 | objects are not normally packed tightly into pages. |
350038ff | 160 | Pages with even one in-use object are considered in-use and cannot be |
fea681da | 161 | freed. |
eabf3ae5 | 162 | .PP |
27e78df1 MK |
163 | Kernels configured with |
164 | .B CONFIG_DEBUG_SLAB | |
165 | will also have additional statistics fields in each line, | |
166 | and the first line of the file will contain the string "(statistics)". | |
167 | The statistics field include : the high water mark of active | |
fea681da MK |
168 | objects; the number of times objects have been allocated; |
169 | the number of times the cache has grown (new pages added | |
170 | to this cache); the number of times the cache has been | |
171 | reaped (unused pages removed from this cache); and the | |
172 | number of times there was an error allocating new pages | |
c13182ef | 173 | to this cache. |
27e78df1 MK |
174 | .\" |
175 | .\" SMP systems will also have "(SMP)" in the first line of | |
176 | .\" output, and will have two additional columns for each slab, | |
177 | .\" reporting the slab allocation policy for the CPU-local | |
178 | .\" cache (to reduce the need for inter-CPU synchronization | |
179 | .\" when allocating objects from the cache). | |
180 | .\" The first column is the per-CPU limit: the maximum number of objects that | |
181 | .\" will be cached for each CPU. | |
182 | .\" The second column is the | |
183 | .\" batchcount: the maximum number of free objects in the | |
184 | .\" global cache that will be transferred to the per-CPU cache | |
185 | .\" if it is empty, or the number of objects to be returned | |
186 | .\" to the global cache if the per-CPU cache is full. | |
187 | .\" | |
188 | .\" If both slab cache statistics and SMP are defined, there | |
189 | .\" will be four additional columns, reporting the per-CPU | |
190 | .\" cache statistics. | |
191 | .\" The first two are the per-CPU cache | |
192 | .\" allocation hit and miss counts: the number of times an | |
193 | .\" object was or was not available in the per-CPU cache | |
194 | .\" for allocation. | |
195 | .\" The next two are the per-CPU cache free | |
196 | .\" hit and miss counts: the number of times a freed object | |
197 | .\" could or could not fit within the per-CPU cache limit, | |
198 | .\" before flushing objects to the global cache. | |
a759cc87 | 199 | .SH VERSIONS |
27e78df1 | 200 | The |
fea681da | 201 | .I /proc/slabinfo |
27e78df1 MK |
202 | file first appeared in Linux 2.1.23. |
203 | The file is versioned, | |
204 | and over time there have been a number of versions with different layouts: | |
205 | .TP | |
206 | 1.0 | |
207 | Present throughout the Linux 2.2.x kernel series. | |
208 | .TP | |
209 | 1.1 | |
210 | Present in the Linux 2.4.x kernel series. | |
211 | .\" First appeared in 2.4.0-test3 | |
212 | .TP | |
213 | 1.2 | |
214 | A format that was briefly present in the Linux 2.5 development series. | |
215 | .\" from 2.5.45 to 2.5.70 | |
216 | .TP | |
217 | 2.0 | |
218 | Present in Linux 2.6.x kernels up to and including Linux 2.6.9. | |
219 | .\" First appeared in 2.5.71 | |
220 | .TP | |
221 | 2.1 | |
222 | The current format, which first appeared in Linux 2.6.10. | |
350038ff | 223 | .SH NOTES |
27e78df1 MK |
224 | Only root can read and (if the kernel was configured with |
225 | .BR CONFIG_SLAB ) | |
226 | write the | |
227 | .IR /proc/slabinfo | |
228 | file. | |
eabf3ae5 | 229 | .PP |
2b5139c5 MK |
230 | The total amount of memory allocated to the SLAB/SLUB cache is shown in the |
231 | .I Slab | |
232 | field of | |
233 | .IR /proc/meminfo . | |
6284854c MK |
234 | .SH SEE ALSO |
235 | .BR slabtop (1) | |
eabf3ae5 | 236 | .PP |
4040b0a5 MK |
237 | The kernel source file |
238 | .IR Documentation/vm/slub.txt | |
239 | and | |
240 | .IR tools/vm/slabinfo.c . |