Debian Codegraph @

upstream/debian-unstable/man5/slabinfo.5

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