mirror of
https://gitlab.com/procps-ng/procps.git
synced 2024-12-04 15:34:22 +08:00
3569c0351f
tmpfs has become much more widely used since distributions use it for /tmp (Fedora 18+). In /proc/meminfo, memory used by tmpfs is accounted into "Cached" (aka "NR_FILE_PAGES", http://lxr.free-electrons.com/source/mm/shmem.c#L301 ). The tools just pass it on, so what top, free and vmstat report as "cached" is the sum of page cache and tmpfs. free has the extremely useful "-/+ buffers/cache" output. However, now that tmpfs is accounted into "cached", those numbers are way off once you have big files in /tmp. Fortunately, kernel 2.6.32 introduces "Shmem", which makes tmpfs memory usage accessible from userspace ( https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4b02108ac1b3354a22b0d83c684797692efdc395 ). This patch substracts Shmem from Cached to get the actual page cache memory. This makes both issues mentioned above disappear. For older kernels, Shmem is not available (hence zero) and this patch is no-op. Additionally: * Update the man pages of free and vmstat to explain what is happening * Finally drop "MemShared" from the /proc/meminfo parser, it has been dead for 10+ years and is only causing confusion ( removed in kernel 2.5.54, see https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/?id=fe04e9451e5a159247cf9f03c615a4273ac0c571 )
120 lines
2.9 KiB
Groff
120 lines
2.9 KiB
Groff
.\" -*-Nroff-*-
|
|
.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
|
|
.\" Long options where added at April 15th, 2011.
|
|
.\" Freely distributable under the terms of the GPL
|
|
.TH FREE 1 "September 2011" "procps-ng" "User Commands"
|
|
.SH NAME
|
|
free \- Display amount of free and used memory in the system
|
|
.SH SYNOPSIS
|
|
.B free
|
|
.RI [ options ]
|
|
.SH DESCRIPTION
|
|
.B free
|
|
displays the total amount of free and used physical and swap memory in the
|
|
system, as well as the buffers and caches used by the kernel. The
|
|
information is gathered by parsing /proc/meminfo. The displayed
|
|
columns are:
|
|
.TP
|
|
\fBtotal\fR
|
|
Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
|
|
.TP
|
|
\fBused\fR
|
|
Used memory (calculated as total - free)
|
|
.TP
|
|
\fBfree\fR
|
|
Unused memory (MemFree and SwapFree in /proc/meminfo)
|
|
.TP
|
|
\fBshared\fR
|
|
Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on
|
|
kernels 2.6.32, displayed as zero if not available)
|
|
.TP
|
|
\fBbuffers\fR
|
|
Memory used by kernel buffers (Buffers in /proc/meminfo)
|
|
.TP
|
|
\fBcached\fR
|
|
Memory used by the page cache (calculated as Cached - Shmem in
|
|
/proc/meminfo - the Cached value is actually the sum of page cache and
|
|
tmpfs memory)
|
|
.SH OPTIONS
|
|
.TP
|
|
\fB\-b\fR, \fB\-\-bytes\fR
|
|
Display the amount of memory in bytes.
|
|
.TP
|
|
\fB\-k\fR, \fB\-\-kilo\fR
|
|
Display the amount of memory in kilobytes. This is the default.
|
|
.TP
|
|
\fB\-m\fR, \fB\-\-mega\fR
|
|
Display the amount of memory in megabytes.
|
|
.TP
|
|
\fB\-g\fR, \fB\-\-giga\fR
|
|
Display the amount of memory in gigabytes.
|
|
.TP
|
|
\fB\-\-tera\fR
|
|
Display the amount of memory in terabytes.
|
|
.TP
|
|
\fB\-h\fR, \fB\-\-human\fP
|
|
Show all output fields automatically scaled to shortest three digit unit and
|
|
display the units of print out. Following units are used.
|
|
.sp
|
|
.nf
|
|
B = bytes
|
|
K = kilos
|
|
M = megas
|
|
G = gigas
|
|
T = teras
|
|
.fi
|
|
.sp
|
|
If unit is missing, and you have petabyte of RAM or swap, the number is in
|
|
terabytes and columns might not be aligned with header.
|
|
.TP
|
|
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
|
|
Display the result
|
|
.I count
|
|
times. Requires the
|
|
.B \-s
|
|
option.
|
|
.TP
|
|
\fB\-l\fR, \fB\-\-lohi\fR
|
|
Show detailed low and high memory statistics.
|
|
.TP
|
|
\fB\-o\fR, \fB\-\-old\fR
|
|
Display the output in old format, the only difference being this option
|
|
will disable the display of the "buffer adjusted" line.
|
|
.TP
|
|
\fB\-s\fR, \fB\-\-seconds\fR \fIseconds\fR
|
|
Continuously display the result delay
|
|
.I seconds
|
|
apart. You may actually specify any floating point number for
|
|
.IR delay ,
|
|
.BR usleep (3)
|
|
is used for microsecond resolution delay times.
|
|
.TP
|
|
\fB\-\-si\fR
|
|
Use power of 1000 not 1024.
|
|
.TP
|
|
\fB\-t\fR, \fB\-\-total\fR
|
|
Display a line showing the column totals.
|
|
.TP
|
|
\fB\-\-help\fR
|
|
Print help.
|
|
.TP
|
|
\fB\-V\fR, \fB\-\-version\fR
|
|
Display version information.
|
|
.PD
|
|
.SH FILES
|
|
.TP
|
|
/proc/meminfo
|
|
memory information
|
|
.PD
|
|
.SH "SEE ALSO"
|
|
.BR ps (1),
|
|
.BR slabtop (1),
|
|
.BR top "(1),
|
|
.BR vmstat (8).
|
|
.SH AUTHORS
|
|
Written by Brian Edmonds.
|
|
.SH "REPORTING BUGS"
|
|
Please send bug reports to
|
|
.UR procps@freelists.org
|
|
.UE
|