1SLABINFO(5) Linux Programmer's Manual SLABINFO(5)
2
3
4
6 slabinfo - kernel slab allocator statistics
7
9 cat /proc/slabinfo
10
12 Frequently used objects in the Linux kernel (buffer heads, inodes, den‐
13 tries, etc.) have their own cache. The file /proc/slabinfo gives sta‐
14 tistics on these caches. The following (edited) output shows an exam‐
15 ple of the contents of this file:
16
17 $ sudo cat /proc/slabinfo
18 slabinfo - version: 2.1
19 # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> ...
20 sigqueue 100 100 160 25 1 : tunables 0 0 0 : slabdata 4 4 0
21 sighand_cache 355 405 2112 15 8 : tunables 0 0 0 : slabdata 27 27 0
22 kmalloc-8192 96 96 8192 4 8 : tunables 0 0 0 : slabdata 24 24 0
23 ...
24
25 The first line of output includes a version number, which allows an ap‐
26 plication that is reading the file to handle changes in the file for‐
27 mat. (See VERSIONS, below.) The next line lists the names of the col‐
28 umns in the remaining lines.
29
30 Each of the remaining lines displays information about a specified
31 cache. Following the cache name, the output shown in each line shows
32 three components for each cache:
33
34 * statistics
35
36 * tunables
37
38 * slabdata
39
40 The statistics are as follows:
41
42 active_objs
43 The number of objects that are currently active (i.e., in use).
44
45 num_objs
46 The total number of allocated objects (i.e., objects that are
47 both in use and not in use).
48
49 objsize
50 The size of objects in this slab, in bytes.
51
52 objperslab
53 The number of objects stored in each slab.
54
55 pagesperslab
56 The number of pages allocated for each slab.
57
58 The tunables entries in each line show tunable parameters for the cor‐
59 responding cache. When using the default SLUB allocator, there are no
60 tunables, the /proc/slabinfo file is not writable, and the value 0 is
61 shown in these fields. When using the older SLAB allocator, the tun‐
62 ables for a particular cache can be set by writing lines of the follow‐
63 ing form to /proc/slabinfo:
64
65 # echo 'name limit batchcount sharedfactor' > /proc/slabinfo
66
67 Here, name is the cache name, and limit, batchcount, and sharedfactor
68 are integers defining new values for the corresponding tunables. The
69 limit value should be a positive value, batchcount should be a positive
70 value that is less than or equal to limit, and sharedfactor should be
71 nonnegative. If any of the specified values is invalid, the cache set‐
72 tings are left unchanged.
73
74 The tunables entries in each line contain the following fields:
75
76 limit The maximum number of objects that will be cached.
77
78 batchcount
79 On SMP systems, this specifies the number of objects to transfer
80 at one time when refilling the available object list.
81
82 sharedfactor
83 [To be documented]
84
85 The slabdata entries in each line contain the following fields:
86
87 active_slabs
88 The number of active slabs.
89
90 nums_slabs
91 The total number of slabs.
92
93 sharedavail
94 [To be documented]
95
96 Note that because of object alignment and slab cache overhead, objects
97 are not normally packed tightly into pages. Pages with even one in-use
98 object are considered in-use and cannot be freed.
99
100 Kernels configured with CONFIG_DEBUG_SLAB will also have additional
101 statistics fields in each line, and the first line of the file will
102 contain the string "(statistics)". The statistics field include : the
103 high water mark of active objects; the number of times objects have
104 been allocated; the number of times the cache has grown (new pages
105 added to this cache); the number of times the cache has been reaped
106 (unused pages removed from this cache); and the number of times there
107 was an error allocating new pages to this cache.
108
110 The /proc/slabinfo file first appeared in Linux 2.1.23. The file is
111 versioned, and over time there have been a number of versions with dif‐
112 ferent layouts:
113
114 1.0 Present throughout the Linux 2.2.x kernel series.
115
116 1.1 Present in the Linux 2.4.x kernel series.
117
118 1.2 A format that was briefly present in the Linux 2.5 development
119 series.
120
121 2.0 Present in Linux 2.6.x kernels up to and including Linux 2.6.9.
122
123 2.1 The current format, which first appeared in Linux 2.6.10.
124
126 Only root can read and (if the kernel was configured with CONFIG_SLAB)
127 write the /proc/slabinfo file.
128
129 The total amount of memory allocated to the SLAB/SLUB cache is shown in
130 the Slab field of /proc/meminfo.
131
133 slabtop(1)
134
135 The kernel source file Documentation/vm/slub.txt and
136 tools/vm/slabinfo.c.
137
139 This page is part of release 5.13 of the Linux man-pages project. A
140 description of the project, information about reporting bugs, and the
141 latest version of this page, can be found at
142 https://www.kernel.org/doc/man-pages/.
143
144
145
146 2021-03-22 SLABINFO(5)