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