man-pages/man5/slabinfo.5.html
2021-03-31 01:06:50 +01:00

320 lines
6.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SLABINFO</TITLE>
</HEAD><BODY>
<H1>SLABINFO</H1>
Section: Linux Programmer's Manual (5)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
slabinfo - kernel slab allocator statistics
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>cat /proc/slabinfo</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Frequently used objects in the Linux kernel
(buffer heads, inodes, dentries, etc.)
have their own cache.
The file
<I>/proc/slabinfo</I>
gives statistics on these caches.
The following (edited) output shows an example of the
contents of this file:
<P>
$ <B>sudo cat /proc/slabinfo</B>
slabinfo - version: 2.1
# name &lt;active_objs&gt; &lt;num_objs&gt; &lt;objsize&gt; &lt;objperslab&gt; &lt;pagesperslab&gt; ...
sigqueue 100 100 160 25 1 : tunables 0 0 0 : slabdata 4 4 0
sighand_cache 355 405 2112 15 8 : tunables 0 0 0 : slabdata 27 27 0
kmalloc-8192 96 96 8192 4 8 : tunables 0 0 0 : slabdata 24 24 0
...
<P>
The first line of output includes a version number,
which allows an application that is reading the file to handle changes
in the file format.
(See VERSIONS, below.)
The next line lists the names of the columns in the remaining lines.
<P>
Each of the remaining lines displays information about a specified cache.
Following the cache name,
the output shown in each line shows three components for each cache:
<DL COMPACT>
<DT id="1">*<DD>
statistics
<DT id="2">*<DD>
tunables
<DT id="3">*<DD>
slabdata
</DL>
<P>
The statistics are as follows:
<DL COMPACT>
<DT id="4"><I>active_objs</I>
<DD>
The number of objects that are currently active (i.e., in use).
<DT id="5"><I>num_objs</I>
<DD>
The total number of allocated objects
(i.e., objects that are both in use and not in use).
<DT id="6"><I>objsize</I>
<DD>
The size of objects in this slab, in bytes.
<DT id="7"><I>objperslab</I>
<DD>
The number of objects stored in each slab.
<DT id="8"><I>pagesperslab</I>
<DD>
The number of pages allocated for each slab.
</DL>
<P>
The
<I>tunables</I>
entries in each line show tunable parameters for the corresponding cache.
When using the default SLUB allocator, there are no tunables, the
<I>/proc/slabinfo</I>
file is not writable, and the value 0 is shown in these fields.
When using the older SLAB allocator,
the tunables for a particular cache can be set by writing
lines of the following form to
<I>/proc/slabinfo</I>:
<P>
# <B>echo 'name limit batchcount sharedfactor' &gt; /proc/slabinfo</B>
<P>
Here,
<I>name</I>
is the cache name, and
<I>limit</I>,
<I>batchcount</I>,
and
<I>sharedfactor</I>
are integers defining new values for the corresponding tunables.
The
<I>limit</I>
value should be a positive value,
<I>batchcount</I>
should be a positive value that is less than or equal to
<I>limit</I>,
and
<I>sharedfactor</I>
should be nonnegative.
If any of the specified values is invalid,
the cache settings are left unchanged.
<P>
The
<I>tunables</I>
entries in each line contain the following fields:
<DL COMPACT>
<DT id="9"><I>limit</I>
<DD>
The maximum number of objects that will be cached.
<DT id="10"><I>batchcount</I>
<DD>
On SMP systems, this specifies the number of objects to transfer at one time
when refilling the available object list.
<DT id="11"><I>sharedfactor</I>
<DD>
[To be documented]
</DL>
<P>
The
<I>slabdata</I>
entries in each line contain the following fields:
<DL COMPACT>
<DT id="12"><I>active_slabs</I>
<DD>
The number of active slabs.
<DT id="13"><I>nums_slabs</I>
<DD>
The total number of slabs.
<DT id="14"><I>sharedavail</I>
<DD>
[To be documented]
</DL>
<P>
Note that because of object alignment and slab cache overhead,
objects are not normally packed tightly into pages.
Pages with even one in-use object are considered in-use and cannot be
freed.
<P>
Kernels configured with
<B>CONFIG_DEBUG_SLAB</B>
will also have additional statistics fields in each line,
and the first line of the file will contain the string &quot;(statistics)&quot;.
The statistics field include : the high water mark of active
objects; the number of times objects have been allocated;
the number of times the cache has grown (new pages added
to this cache); the number of times the cache has been
reaped (unused pages removed from this cache); and the
number of times there was an error allocating new pages
to this cache.
<A NAME="lbAE">&nbsp;</A>
<H2>VERSIONS</H2>
The
<I>/proc/slabinfo</I>
file first appeared in Linux 2.1.23.
The file is versioned,
and over time there have been a number of versions with different layouts:
<DL COMPACT>
<DT id="15">1.0<DD>
Present throughout the Linux 2.2.x kernel series.
<DT id="16">1.1<DD>
Present in the Linux 2.4.x kernel series.
<DT id="17">1.2<DD>
A format that was briefly present in the Linux 2.5 development series.
<DT id="18">2.0<DD>
Present in Linux 2.6.x kernels up to and including Linux 2.6.9.
<DT id="19">2.1<DD>
The current format, which first appeared in Linux 2.6.10.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2>
Only root can read and (if the kernel was configured with
<B>CONFIG_SLAB</B>)
write the
<I>/proc/slabinfo</I>
file.
<P>
The total amount of memory allocated to the SLAB/SLUB cache is shown in the
<I>Slab</I>
field of
<I>/proc/meminfo</I>.
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+slabtop">slabtop</A></B>(1)
<P>
The kernel source file
<I>Documentation/vm/slub.txt</I>
and
<I>tools/vm/slabinfo.c</I>.
<A NAME="lbAH">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="20"><A HREF="#lbAB">NAME</A><DD>
<DT id="21"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="22"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="23"><A HREF="#lbAE">VERSIONS</A><DD>
<DT id="24"><A HREF="#lbAF">NOTES</A><DD>
<DT id="25"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="26"><A HREF="#lbAH">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:05 GMT, March 31, 2021
</BODY>
</HTML>