]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/slabinfo.5
adjtimex.2, futex.2, mremap.2, seccomp.2, getnameinfo.3, random.3, console_codes...
[thirdparty/man-pages.git] / man5 / slabinfo.5
CommitLineData
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 28slabinfo \- kernel slab allocator statistics
fea681da
MK
29.SH SYNOPSIS
30.B cat /proc/slabinfo
31.SH DESCRIPTION
32Frequently used objects in the Linux kernel
33(buffer heads, inodes, dentries, etc.)
c13182ef
MK
34have their own cache.
35The file
fea681da 36.I /proc/slabinfo
27e78df1
MK
37gives statistics on these caches.
38The following (edited) output shows an example of the
39contents of this file:
dd3568a1 40.PP
27e78df1 41.in 0
9c40f2b9 42.EX
27e78df1
MK
43$ \fBsudo cat /proc/slabinfo\fP
44slabinfo - version: 2.1
45# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> ...
46sigqueue 100 100 160 25 1 : tunables 0 0 0 : slabdata 4 4 0
47sighand_cache 355 405 2112 15 8 : tunables 0 0 0 : slabdata 27 27 0
48kmalloc-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
53The first line of output includes a version number,
54which allows an application that is reading the file to handle changes
55in the file format.
56(See VERSIONS, below.)
57The next line lists the names of the columns in the remaining lines.
eabf3ae5 58.PP
27e78df1
MK
59Each of the remaining lines displays information about a specified cache.
60Following the cache name,
61the output shown in each line shows three components for each cache:
62.IP * 3
63statistics
64.IP *
65tunables
66.IP *
67slabdata
68.PP
69The statistics are as follows:
70.TP
71.I active_objs
72The number of objects that are currently active (i.e., in use).
73.TP
74.I num_objs
75The total number of allocated objects
76(i.e., objects that are both in use and not in use).
77.TP
78.I objsize
79The size of objects in this slab, in bytes.
80.TP
81.I objperslab
82The number of objects stored in each slab.
83.TP
84.I pagesperslab
85The number of pages allocated for each slab.
86.PP
87The
88.I tunables
89entries in each line show tunable parameters for the corresponding cache.
90When using the default SLUB allocator, there are no tunables, the
91.I /proc/slabinfo
fa6cebc8 92file is not writable, and the value 0 is shown in these fields.
27e78df1
MK
93When using the older SLAB allocator,
94the tunables for a particular cache can be set by writing
95lines 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
104Here,
105.I name
106is the cache name, and
107.IR limit ,
108.IR batchcount ,
109and
110.IR sharedfactor
111are integers defining new values for the corresponding tunables.
35737fdb
MK
112The
113.I limit
114value should be a positive value,
115.I batchcount
116should be a positive value that is less than or equal to
117.IR limit ,
118and
119.I sharedfactor
120should be nonnegative.
121If any of the specified values is invalid,
122the cache settings are left unchanged.
eabf3ae5 123.PP
27e78df1
MK
124The
125.I tunables
126entries in each line contain the following fields:
127.TP
128.I limit
129The 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
135On SMP systems, this specifies the number of objects to transfer at one time
136when 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
145The
146.I slabdata
147entries in each line contain the following fields:
148.TP
149.I active_slabs
150The number of active slabs.
151.TP
152.I nums_slabs
153The total number of slabs.
154.TP
155.I sharedavail
156[To be documented]
157.PP
fea681da 158Note that because of object alignment and slab cache overhead,
c13182ef 159objects are not normally packed tightly into pages.
350038ff 160Pages with even one in-use object are considered in-use and cannot be
fea681da 161freed.
eabf3ae5 162.PP
27e78df1
MK
163Kernels configured with
164.B CONFIG_DEBUG_SLAB
165will also have additional statistics fields in each line,
166and the first line of the file will contain the string "(statistics)".
167The statistics field include : the high water mark of active
fea681da
MK
168objects; the number of times objects have been allocated;
169the number of times the cache has grown (new pages added
170to this cache); the number of times the cache has been
171reaped (unused pages removed from this cache); and the
172number of times there was an error allocating new pages
c13182ef 173to 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 200The
fea681da 201.I /proc/slabinfo
27e78df1
MK
202file first appeared in Linux 2.1.23.
203The file is versioned,
204and over time there have been a number of versions with different layouts:
205.TP
2061.0
207Present throughout the Linux 2.2.x kernel series.
208.TP
2091.1
210Present in the Linux 2.4.x kernel series.
211.\" First appeared in 2.4.0-test3
212.TP
2131.2
214A format that was briefly present in the Linux 2.5 development series.
215.\" from 2.5.45 to 2.5.70
216.TP
2172.0
218Present in Linux 2.6.x kernels up to and including Linux 2.6.9.
219.\" First appeared in 2.5.71
220.TP
2212.1
222The current format, which first appeared in Linux 2.6.10.
350038ff 223.SH NOTES
27e78df1
MK
224Only root can read and (if the kernel was configured with
225.BR CONFIG_SLAB )
226write the
227.IR /proc/slabinfo
228file.
eabf3ae5 229.PP
2b5139c5
MK
230The total amount of memory allocated to the SLAB/SLUB cache is shown in the
231.I Slab
232field of
233.IR /proc/meminfo .
6284854c
MK
234.SH SEE ALSO
235.BR slabtop (1)
eabf3ae5 236.PP
4040b0a5
MK
237The kernel source file
238.IR Documentation/vm/slub.txt
239and
240.IR tools/vm/slabinfo.c .