xref: /linux/Documentation/filesystems/proc.rst (revision 61307b7be41a1f1039d1d1368810a1d92cb97b44)
1c33e97efSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2c33e97efSMauro Carvalho Chehab
3c33e97efSMauro Carvalho Chehab====================
4c33e97efSMauro Carvalho ChehabThe /proc Filesystem
5c33e97efSMauro Carvalho Chehab====================
6c33e97efSMauro Carvalho Chehab
7c33e97efSMauro Carvalho Chehab=====================  =======================================  ================
8c33e97efSMauro Carvalho Chehab/proc/sys              Terrehon Bowden <terrehon@pacbell.net>,  October 7 1999
9c33e97efSMauro Carvalho Chehab                       Bodo Bauer <bb@ricochet.net>
10c33e97efSMauro Carvalho Chehab2.4.x update	       Jorge Nerin <comandante@zaralinux.com>   November 14 2000
11c33e97efSMauro Carvalho Chehabmove /proc/sys	       Shen Feng <shen@cn.fujitsu.com>	        April 1 2009
12c33e97efSMauro Carvalho Chehabfixes/update part 1.1  Stefani Seibold <stefani@seibold.net>    June 9 2009
13c33e97efSMauro Carvalho Chehab=====================  =======================================  ================
14c33e97efSMauro Carvalho Chehab
15c33e97efSMauro Carvalho Chehab
16c33e97efSMauro Carvalho Chehab
17c33e97efSMauro Carvalho Chehab.. Table of Contents
18c33e97efSMauro Carvalho Chehab
19c33e97efSMauro Carvalho Chehab  0     Preface
20c33e97efSMauro Carvalho Chehab  0.1	Introduction/Credits
21c33e97efSMauro Carvalho Chehab  0.2	Legal Stuff
22c33e97efSMauro Carvalho Chehab
23c33e97efSMauro Carvalho Chehab  1	Collecting System Information
24c33e97efSMauro Carvalho Chehab  1.1	Process-Specific Subdirectories
25c33e97efSMauro Carvalho Chehab  1.2	Kernel data
26c33e97efSMauro Carvalho Chehab  1.3	IDE devices in /proc/ide
27c33e97efSMauro Carvalho Chehab  1.4	Networking info in /proc/net
28c33e97efSMauro Carvalho Chehab  1.5	SCSI info
29c33e97efSMauro Carvalho Chehab  1.6	Parallel port info in /proc/parport
30c33e97efSMauro Carvalho Chehab  1.7	TTY info in /proc/tty
31c33e97efSMauro Carvalho Chehab  1.8	Miscellaneous kernel statistics in /proc/stat
32c33e97efSMauro Carvalho Chehab  1.9	Ext4 file system parameters
33c33e97efSMauro Carvalho Chehab
34c33e97efSMauro Carvalho Chehab  2	Modifying System Parameters
35c33e97efSMauro Carvalho Chehab
36c33e97efSMauro Carvalho Chehab  3	Per-Process Parameters
37c33e97efSMauro Carvalho Chehab  3.1	/proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj - Adjust the oom-killer
38c33e97efSMauro Carvalho Chehab								score
39c33e97efSMauro Carvalho Chehab  3.2	/proc/<pid>/oom_score - Display current oom-killer score
40c33e97efSMauro Carvalho Chehab  3.3	/proc/<pid>/io - Display the IO accounting fields
41c33e97efSMauro Carvalho Chehab  3.4	/proc/<pid>/coredump_filter - Core dump filtering settings
42c33e97efSMauro Carvalho Chehab  3.5	/proc/<pid>/mountinfo - Information about mounts
43c33e97efSMauro Carvalho Chehab  3.6	/proc/<pid>/comm  & /proc/<pid>/task/<tid>/comm
44c33e97efSMauro Carvalho Chehab  3.7   /proc/<pid>/task/<tid>/children - Information about task children
45c33e97efSMauro Carvalho Chehab  3.8   /proc/<pid>/fdinfo/<fd> - Information about opened file
46c33e97efSMauro Carvalho Chehab  3.9   /proc/<pid>/map_files - Information about memory mapped files
47c33e97efSMauro Carvalho Chehab  3.10  /proc/<pid>/timerslack_ns - Task timerslack value
48c33e97efSMauro Carvalho Chehab  3.11	/proc/<pid>/patch_state - Livepatch patch operation state
49c33e97efSMauro Carvalho Chehab  3.12	/proc/<pid>/arch_status - Task architecture specific information
50f1f1f256SIvan Babrou  3.13  /proc/<pid>/fd - List of symlinks to open files
51c33e97efSMauro Carvalho Chehab
52c33e97efSMauro Carvalho Chehab  4	Configuring procfs
53c33e97efSMauro Carvalho Chehab  4.1	Mount options
54c33e97efSMauro Carvalho Chehab
5537e7647aSAlexey Gladkov  5	Filesystem behavior
5637e7647aSAlexey Gladkov
57c33e97efSMauro Carvalho ChehabPreface
58c33e97efSMauro Carvalho Chehab=======
59c33e97efSMauro Carvalho Chehab
60c33e97efSMauro Carvalho Chehab0.1 Introduction/Credits
61c33e97efSMauro Carvalho Chehab------------------------
62c33e97efSMauro Carvalho Chehab
63c33e97efSMauro Carvalho ChehabThis documentation is  part of a soon (or  so we hope) to be  released book on
64c33e97efSMauro Carvalho Chehabthe SuSE  Linux distribution. As  there is  no complete documentation  for the
65c33e97efSMauro Carvalho Chehab/proc file system and we've used  many freely available sources to write these
66c33e97efSMauro Carvalho Chehabchapters, it  seems only fair  to give the work  back to the  Linux community.
67c33e97efSMauro Carvalho ChehabThis work is  based on the 2.2.*  kernel version and the  upcoming 2.4.*. I'm
68c33e97efSMauro Carvalho Chehabafraid it's still far from complete, but we  hope it will be useful. As far as
69c33e97efSMauro Carvalho Chehabwe know, it is the first 'all-in-one' document about the /proc file system. It
70c33e97efSMauro Carvalho Chehabis focused  on the Intel  x86 hardware,  so if you  are looking for  PPC, ARM,
71c33e97efSMauro Carvalho ChehabSPARC, AXP, etc., features, you probably  won't find what you are looking for.
72c33e97efSMauro Carvalho ChehabIt also only covers IPv4 networking, not IPv6 nor other protocols - sorry. But
73c33e97efSMauro Carvalho Chehabadditions and patches  are welcome and will  be added to this  document if you
74c33e97efSMauro Carvalho Chehabmail them to Bodo.
75c33e97efSMauro Carvalho Chehab
76c33e97efSMauro Carvalho ChehabWe'd like  to  thank Alan Cox, Rik van Riel, and Alexey Kuznetsov and a lot of
77c33e97efSMauro Carvalho Chehabother people for help compiling this documentation. We'd also like to extend a
78c33e97efSMauro Carvalho Chehabspecial thank  you to Andi Kleen for documentation, which we relied on heavily
79c33e97efSMauro Carvalho Chehabto create  this  document,  as well as the additional information he provided.
80c33e97efSMauro Carvalho ChehabThanks to  everybody  else  who contributed source or docs to the Linux kernel
81c33e97efSMauro Carvalho Chehaband helped create a great piece of software... :)
82c33e97efSMauro Carvalho Chehab
83c33e97efSMauro Carvalho ChehabIf you  have  any comments, corrections or additions, please don't hesitate to
84c33e97efSMauro Carvalho Chehabcontact Bodo  Bauer  at  bb@ricochet.net.  We'll  be happy to add them to this
85c33e97efSMauro Carvalho Chehabdocument.
86c33e97efSMauro Carvalho Chehab
87c33e97efSMauro Carvalho ChehabThe   latest   version    of   this   document   is    available   online   at
88d2ea66a6SRandy Dunlaphttps://www.kernel.org/doc/html/latest/filesystems/proc.html
89c33e97efSMauro Carvalho Chehab
90c33e97efSMauro Carvalho ChehabIf  the above  direction does  not works  for you,  you could  try the  kernel
91c33e97efSMauro Carvalho Chehabmailing  list  at  linux-kernel@vger.kernel.org  and/or try  to  reach  me  at
92c33e97efSMauro Carvalho Chehabcomandante@zaralinux.com.
93c33e97efSMauro Carvalho Chehab
94c33e97efSMauro Carvalho Chehab0.2 Legal Stuff
95c33e97efSMauro Carvalho Chehab---------------
96c33e97efSMauro Carvalho Chehab
97c33e97efSMauro Carvalho ChehabWe don't  guarantee  the  correctness  of this document, and if you come to us
98c33e97efSMauro Carvalho Chehabcomplaining about  how  you  screwed  up  your  system  because  of  incorrect
99c33e97efSMauro Carvalho Chehabdocumentation, we won't feel responsible...
100c33e97efSMauro Carvalho Chehab
101c33e97efSMauro Carvalho ChehabChapter 1: Collecting System Information
102c33e97efSMauro Carvalho Chehab========================================
103c33e97efSMauro Carvalho Chehab
104c33e97efSMauro Carvalho ChehabIn This Chapter
105c33e97efSMauro Carvalho Chehab---------------
106c33e97efSMauro Carvalho Chehab* Investigating  the  properties  of  the  pseudo  file  system  /proc and its
107c33e97efSMauro Carvalho Chehab  ability to provide information on the running Linux system
108c33e97efSMauro Carvalho Chehab* Examining /proc's structure
109c33e97efSMauro Carvalho Chehab* Uncovering  various  information  about the kernel and the processes running
110c33e97efSMauro Carvalho Chehab  on the system
111c33e97efSMauro Carvalho Chehab
112c33e97efSMauro Carvalho Chehab------------------------------------------------------------------------------
113c33e97efSMauro Carvalho Chehab
114c33e97efSMauro Carvalho ChehabThe proc  file  system acts as an interface to internal data structures in the
115c33e97efSMauro Carvalho Chehabkernel. It  can  be  used to obtain information about the system and to change
116c33e97efSMauro Carvalho Chehabcertain kernel parameters at runtime (sysctl).
117c33e97efSMauro Carvalho Chehab
118c33e97efSMauro Carvalho ChehabFirst, we'll  take  a  look  at the read-only parts of /proc. In Chapter 2, we
119c33e97efSMauro Carvalho Chehabshow you how you can use /proc/sys to change settings.
120c33e97efSMauro Carvalho Chehab
121c33e97efSMauro Carvalho Chehab1.1 Process-Specific Subdirectories
122c33e97efSMauro Carvalho Chehab-----------------------------------
123c33e97efSMauro Carvalho Chehab
124c33e97efSMauro Carvalho ChehabThe directory  /proc  contains  (among other things) one subdirectory for each
125c33e97efSMauro Carvalho Chehabprocess running on the system, which is named after the process ID (PID).
126c33e97efSMauro Carvalho Chehab
127059db434SRandy DunlapThe link  'self'  points to  the process reading the file system. Each process
128c33e97efSMauro Carvalho Chehabsubdirectory has the entries listed in Table 1-1.
129c33e97efSMauro Carvalho Chehab
130059db434SRandy DunlapNote that an open file descriptor to /proc/<pid> or to any of its
131c33e97efSMauro Carvalho Chehabcontained files or subdirectories does not prevent <pid> being reused
132c33e97efSMauro Carvalho Chehabfor some other process in the event that <pid> exits. Operations on
133c33e97efSMauro Carvalho Chehabopen /proc/<pid> file descriptors corresponding to dead processes
134c33e97efSMauro Carvalho Chehabnever act on any new process that the kernel may, through chance, have
135c33e97efSMauro Carvalho Chehabalso assigned the process ID <pid>. Instead, operations on these FDs
136c33e97efSMauro Carvalho Chehabusually fail with ESRCH.
137c33e97efSMauro Carvalho Chehab
138c33e97efSMauro Carvalho Chehab.. table:: Table 1-1: Process specific entries in /proc
139c33e97efSMauro Carvalho Chehab
140c33e97efSMauro Carvalho Chehab =============  ===============================================================
141c33e97efSMauro Carvalho Chehab File		Content
142c33e97efSMauro Carvalho Chehab =============  ===============================================================
143c33e97efSMauro Carvalho Chehab clear_refs	Clears page referenced bits shown in smaps output
144c33e97efSMauro Carvalho Chehab cmdline	Command line arguments
145c33e97efSMauro Carvalho Chehab cpu		Current and last cpu in which it was executed	(2.4)(smp)
146c33e97efSMauro Carvalho Chehab cwd		Link to the current working directory
147c33e97efSMauro Carvalho Chehab environ	Values of environment variables
148c33e97efSMauro Carvalho Chehab exe		Link to the executable of this process
149c33e97efSMauro Carvalho Chehab fd		Directory, which contains all file descriptors
150c33e97efSMauro Carvalho Chehab maps		Memory maps to executables and library files	(2.4)
151c33e97efSMauro Carvalho Chehab mem		Memory held by this process
152c33e97efSMauro Carvalho Chehab root		Link to the root directory of this process
153c33e97efSMauro Carvalho Chehab stat		Process status
154c33e97efSMauro Carvalho Chehab statm		Process memory status information
155c33e97efSMauro Carvalho Chehab status		Process status in human readable form
156c33e97efSMauro Carvalho Chehab wchan		Present with CONFIG_KALLSYMS=y: it shows the kernel function
157c33e97efSMauro Carvalho Chehab		symbol the task is blocked in - or "0" if not blocked.
158c33e97efSMauro Carvalho Chehab pagemap	Page table
159c33e97efSMauro Carvalho Chehab stack		Report full stack trace, enable via CONFIG_STACKTRACE
160c33e97efSMauro Carvalho Chehab smaps		An extension based on maps, showing the memory consumption of
161c33e97efSMauro Carvalho Chehab		each mapping and flags associated with it
162c33e97efSMauro Carvalho Chehab smaps_rollup	Accumulated smaps stats for all mappings of the process.  This
163c33e97efSMauro Carvalho Chehab		can be derived from smaps, but is faster and more convenient
164c33e97efSMauro Carvalho Chehab numa_maps	An extension based on maps, showing the memory locality and
165c33e97efSMauro Carvalho Chehab		binding policy as well as mem usage (in pages) of each mapping.
166c33e97efSMauro Carvalho Chehab =============  ===============================================================
167c33e97efSMauro Carvalho Chehab
168c33e97efSMauro Carvalho ChehabFor example, to get the status information of a process, all you have to do is
169c33e97efSMauro Carvalho Chehabread the file /proc/PID/status::
170c33e97efSMauro Carvalho Chehab
171c33e97efSMauro Carvalho Chehab  >cat /proc/self/status
172c33e97efSMauro Carvalho Chehab  Name:   cat
173c33e97efSMauro Carvalho Chehab  State:  R (running)
174c33e97efSMauro Carvalho Chehab  Tgid:   5452
175c33e97efSMauro Carvalho Chehab  Pid:    5452
176c33e97efSMauro Carvalho Chehab  PPid:   743
177c33e97efSMauro Carvalho Chehab  TracerPid:      0						(2.4)
178c33e97efSMauro Carvalho Chehab  Uid:    501     501     501     501
179c33e97efSMauro Carvalho Chehab  Gid:    100     100     100     100
180c33e97efSMauro Carvalho Chehab  FDSize: 256
181c33e97efSMauro Carvalho Chehab  Groups: 100 14 16
182522dc4e5SChunguang Wu  Kthread:    0
183c33e97efSMauro Carvalho Chehab  VmPeak:     5004 kB
184c33e97efSMauro Carvalho Chehab  VmSize:     5004 kB
185c33e97efSMauro Carvalho Chehab  VmLck:         0 kB
186c33e97efSMauro Carvalho Chehab  VmHWM:       476 kB
187c33e97efSMauro Carvalho Chehab  VmRSS:       476 kB
188c33e97efSMauro Carvalho Chehab  RssAnon:             352 kB
189c33e97efSMauro Carvalho Chehab  RssFile:             120 kB
190c33e97efSMauro Carvalho Chehab  RssShmem:              4 kB
191c33e97efSMauro Carvalho Chehab  VmData:      156 kB
192c33e97efSMauro Carvalho Chehab  VmStk:        88 kB
193c33e97efSMauro Carvalho Chehab  VmExe:        68 kB
194c33e97efSMauro Carvalho Chehab  VmLib:      1412 kB
195c33e97efSMauro Carvalho Chehab  VmPTE:        20 kb
196c33e97efSMauro Carvalho Chehab  VmSwap:        0 kB
197c33e97efSMauro Carvalho Chehab  HugetlbPages:          0 kB
198c33e97efSMauro Carvalho Chehab  CoreDumping:    0
199c33e97efSMauro Carvalho Chehab  THP_enabled:	  1
200c33e97efSMauro Carvalho Chehab  Threads:        1
201c33e97efSMauro Carvalho Chehab  SigQ:   0/28578
202c33e97efSMauro Carvalho Chehab  SigPnd: 0000000000000000
203c33e97efSMauro Carvalho Chehab  ShdPnd: 0000000000000000
204c33e97efSMauro Carvalho Chehab  SigBlk: 0000000000000000
205c33e97efSMauro Carvalho Chehab  SigIgn: 0000000000000000
206c33e97efSMauro Carvalho Chehab  SigCgt: 0000000000000000
207c33e97efSMauro Carvalho Chehab  CapInh: 00000000fffffeff
208c33e97efSMauro Carvalho Chehab  CapPrm: 0000000000000000
209c33e97efSMauro Carvalho Chehab  CapEff: 0000000000000000
210c33e97efSMauro Carvalho Chehab  CapBnd: ffffffffffffffff
211c33e97efSMauro Carvalho Chehab  CapAmb: 0000000000000000
212c33e97efSMauro Carvalho Chehab  NoNewPrivs:     0
213c33e97efSMauro Carvalho Chehab  Seccomp:        0
214c33e97efSMauro Carvalho Chehab  Speculation_Store_Bypass:       thread vulnerable
215fe719888SAnand K Mistry  SpeculationIndirectBranch:      conditional enabled
216c33e97efSMauro Carvalho Chehab  voluntary_ctxt_switches:        0
217c33e97efSMauro Carvalho Chehab  nonvoluntary_ctxt_switches:     1
218c33e97efSMauro Carvalho Chehab
219c33e97efSMauro Carvalho ChehabThis shows you nearly the same information you would get if you viewed it with
220c33e97efSMauro Carvalho Chehabthe ps  command.  In  fact,  ps  uses  the  proc  file  system  to  obtain its
221c33e97efSMauro Carvalho Chehabinformation.  But you get a more detailed  view of the  process by reading the
222c33e97efSMauro Carvalho Chehabfile /proc/PID/status. It fields are described in table 1-2.
223c33e97efSMauro Carvalho Chehab
224c33e97efSMauro Carvalho ChehabThe  statm  file  contains  more  detailed  information about the process
225c33e97efSMauro Carvalho Chehabmemory usage. Its seven fields are explained in Table 1-3.  The stat file
226059db434SRandy Dunlapcontains detailed information about the process itself.  Its fields are
227c33e97efSMauro Carvalho Chehabexplained in Table 1-4.
228c33e97efSMauro Carvalho Chehab
229c33e97efSMauro Carvalho Chehab(for SMP CONFIG users)
230c33e97efSMauro Carvalho Chehab
231c33e97efSMauro Carvalho ChehabFor making accounting scalable, RSS related information are handled in an
232c33e97efSMauro Carvalho Chehabasynchronous manner and the value may not be very precise. To see a precise
233c33e97efSMauro Carvalho Chehabsnapshot of a moment, you can see /proc/<pid>/smaps file and scan page table.
234c33e97efSMauro Carvalho ChehabIt's slow but very precise.
235c33e97efSMauro Carvalho Chehab
236d2ea66a6SRandy Dunlap.. table:: Table 1-2: Contents of the status fields (as of 4.19)
237c33e97efSMauro Carvalho Chehab
238c33e97efSMauro Carvalho Chehab ==========================  ===================================================
239c33e97efSMauro Carvalho Chehab Field                       Content
240c33e97efSMauro Carvalho Chehab ==========================  ===================================================
241c33e97efSMauro Carvalho Chehab Name                        filename of the executable
242c33e97efSMauro Carvalho Chehab Umask                       file mode creation mask
243c33e97efSMauro Carvalho Chehab State                       state (R is running, S is sleeping, D is sleeping
244c33e97efSMauro Carvalho Chehab                             in an uninterruptible wait, Z is zombie,
245c33e97efSMauro Carvalho Chehab			     T is traced or stopped)
246c33e97efSMauro Carvalho Chehab Tgid                        thread group ID
247c33e97efSMauro Carvalho Chehab Ngid                        NUMA group ID (0 if none)
248c33e97efSMauro Carvalho Chehab Pid                         process id
249c33e97efSMauro Carvalho Chehab PPid                        process id of the parent process
250df61e945SChen Linxuan TracerPid                   PID of process tracing this process (0 if not, or
251df61e945SChen Linxuan                             the tracer is outside of the current pid namespace)
252c33e97efSMauro Carvalho Chehab Uid                         Real, effective, saved set, and  file system UIDs
253c33e97efSMauro Carvalho Chehab Gid                         Real, effective, saved set, and  file system GIDs
254c33e97efSMauro Carvalho Chehab FDSize                      number of file descriptor slots currently allocated
255c33e97efSMauro Carvalho Chehab Groups                      supplementary group list
256c33e97efSMauro Carvalho Chehab NStgid                      descendant namespace thread group ID hierarchy
257c33e97efSMauro Carvalho Chehab NSpid                       descendant namespace process ID hierarchy
258c33e97efSMauro Carvalho Chehab NSpgid                      descendant namespace process group ID hierarchy
259c33e97efSMauro Carvalho Chehab NSsid                       descendant namespace session ID hierarchy
260522dc4e5SChunguang Wu Kthread                     kernel thread flag, 1 is yes, 0 is no
261c33e97efSMauro Carvalho Chehab VmPeak                      peak virtual memory size
262c33e97efSMauro Carvalho Chehab VmSize                      total program size
263c33e97efSMauro Carvalho Chehab VmLck                       locked memory size
264c33e97efSMauro Carvalho Chehab VmPin                       pinned memory size
265c33e97efSMauro Carvalho Chehab VmHWM                       peak resident set size ("high water mark")
266c33e97efSMauro Carvalho Chehab VmRSS                       size of memory portions. It contains the three
267c33e97efSMauro Carvalho Chehab                             following parts
268c33e97efSMauro Carvalho Chehab                             (VmRSS = RssAnon + RssFile + RssShmem)
269c33e97efSMauro Carvalho Chehab RssAnon                     size of resident anonymous memory
270c33e97efSMauro Carvalho Chehab RssFile                     size of resident file mappings
271c33e97efSMauro Carvalho Chehab RssShmem                    size of resident shmem memory (includes SysV shm,
272c33e97efSMauro Carvalho Chehab                             mapping of tmpfs and shared anonymous mappings)
273c33e97efSMauro Carvalho Chehab VmData                      size of private data segments
274c33e97efSMauro Carvalho Chehab VmStk                       size of stack segments
275c33e97efSMauro Carvalho Chehab VmExe                       size of text segment
276c33e97efSMauro Carvalho Chehab VmLib                       size of shared library code
277c33e97efSMauro Carvalho Chehab VmPTE                       size of page table entries
278c33e97efSMauro Carvalho Chehab VmSwap                      amount of swap used by anonymous private data
279c33e97efSMauro Carvalho Chehab                             (shmem swap usage is not included)
280c33e97efSMauro Carvalho Chehab HugetlbPages                size of hugetlb memory portions
281c33e97efSMauro Carvalho Chehab CoreDumping                 process's memory is currently being dumped
282c33e97efSMauro Carvalho Chehab                             (killing the process may lead to a corrupted core)
283c33e97efSMauro Carvalho Chehab THP_enabled		     process is allowed to use THP (returns 0 when
284c33e97efSMauro Carvalho Chehab			     PR_SET_THP_DISABLE is set on the process
285c33e97efSMauro Carvalho Chehab Threads                     number of threads
286c33e97efSMauro Carvalho Chehab SigQ                        number of signals queued/max. number for queue
287c33e97efSMauro Carvalho Chehab SigPnd                      bitmap of pending signals for the thread
288c33e97efSMauro Carvalho Chehab ShdPnd                      bitmap of shared pending signals for the process
289c33e97efSMauro Carvalho Chehab SigBlk                      bitmap of blocked signals
290c33e97efSMauro Carvalho Chehab SigIgn                      bitmap of ignored signals
291c33e97efSMauro Carvalho Chehab SigCgt                      bitmap of caught signals
292c33e97efSMauro Carvalho Chehab CapInh                      bitmap of inheritable capabilities
293c33e97efSMauro Carvalho Chehab CapPrm                      bitmap of permitted capabilities
294c33e97efSMauro Carvalho Chehab CapEff                      bitmap of effective capabilities
295c33e97efSMauro Carvalho Chehab CapBnd                      bitmap of capabilities bounding set
296c33e97efSMauro Carvalho Chehab CapAmb                      bitmap of ambient capabilities
297c33e97efSMauro Carvalho Chehab NoNewPrivs                  no_new_privs, like prctl(PR_GET_NO_NEW_PRIV, ...)
298c33e97efSMauro Carvalho Chehab Seccomp                     seccomp mode, like prctl(PR_GET_SECCOMP, ...)
299c33e97efSMauro Carvalho Chehab Speculation_Store_Bypass    speculative store bypass mitigation status
300fe719888SAnand K Mistry SpeculationIndirectBranch   indirect branch speculation mode
301c33e97efSMauro Carvalho Chehab Cpus_allowed                mask of CPUs on which this process may run
302c33e97efSMauro Carvalho Chehab Cpus_allowed_list           Same as previous, but in "list format"
303c33e97efSMauro Carvalho Chehab Mems_allowed                mask of memory nodes allowed to this process
304c33e97efSMauro Carvalho Chehab Mems_allowed_list           Same as previous, but in "list format"
305c33e97efSMauro Carvalho Chehab voluntary_ctxt_switches     number of voluntary context switches
306c33e97efSMauro Carvalho Chehab nonvoluntary_ctxt_switches  number of non voluntary context switches
307c33e97efSMauro Carvalho Chehab ==========================  ===================================================
308c33e97efSMauro Carvalho Chehab
309c33e97efSMauro Carvalho Chehab
310d2ea66a6SRandy Dunlap.. table:: Table 1-3: Contents of the statm fields (as of 2.6.8-rc3)
311c33e97efSMauro Carvalho Chehab
312c33e97efSMauro Carvalho Chehab ======== ===============================	==============================
313c33e97efSMauro Carvalho Chehab Field    Content
314c33e97efSMauro Carvalho Chehab ======== ===============================	==============================
315c33e97efSMauro Carvalho Chehab size     total program size (pages)		(same as VmSize in status)
316c33e97efSMauro Carvalho Chehab resident size of memory portions (pages)	(same as VmRSS in status)
317c33e97efSMauro Carvalho Chehab shared   number of pages that are shared	(i.e. backed by a file, same
318c33e97efSMauro Carvalho Chehab						as RssFile+RssShmem in status)
319c33e97efSMauro Carvalho Chehab trs      number of pages that are 'code'	(not including libs; broken,
320c33e97efSMauro Carvalho Chehab						includes data segment)
321c33e97efSMauro Carvalho Chehab lrs      number of pages of library		(always 0 on 2.6)
322c33e97efSMauro Carvalho Chehab drs      number of pages of data/stack		(including libs; broken,
323c33e97efSMauro Carvalho Chehab						includes library text)
324c33e97efSMauro Carvalho Chehab dt       number of dirty pages			(always 0 on 2.6)
325c33e97efSMauro Carvalho Chehab ======== ===============================	==============================
326c33e97efSMauro Carvalho Chehab
327c33e97efSMauro Carvalho Chehab
328d2ea66a6SRandy Dunlap.. table:: Table 1-4: Contents of the stat fields (as of 2.6.30-rc7)
329c33e97efSMauro Carvalho Chehab
330c33e97efSMauro Carvalho Chehab  ============= ===============================================================
331c33e97efSMauro Carvalho Chehab  Field         Content
332c33e97efSMauro Carvalho Chehab  ============= ===============================================================
333c33e97efSMauro Carvalho Chehab  pid           process id
334c33e97efSMauro Carvalho Chehab  tcomm         filename of the executable
335c33e97efSMauro Carvalho Chehab  state         state (R is running, S is sleeping, D is sleeping in an
336c33e97efSMauro Carvalho Chehab                uninterruptible wait, Z is zombie, T is traced or stopped)
337c33e97efSMauro Carvalho Chehab  ppid          process id of the parent process
338c33e97efSMauro Carvalho Chehab  pgrp          pgrp of the process
339c33e97efSMauro Carvalho Chehab  sid           session id
340c33e97efSMauro Carvalho Chehab  tty_nr        tty the process uses
341c33e97efSMauro Carvalho Chehab  tty_pgrp      pgrp of the tty
342c33e97efSMauro Carvalho Chehab  flags         task flags
343c33e97efSMauro Carvalho Chehab  min_flt       number of minor faults
344c33e97efSMauro Carvalho Chehab  cmin_flt      number of minor faults with child's
345c33e97efSMauro Carvalho Chehab  maj_flt       number of major faults
346c33e97efSMauro Carvalho Chehab  cmaj_flt      number of major faults with child's
347c33e97efSMauro Carvalho Chehab  utime         user mode jiffies
348c33e97efSMauro Carvalho Chehab  stime         kernel mode jiffies
349c33e97efSMauro Carvalho Chehab  cutime        user mode jiffies with child's
350c33e97efSMauro Carvalho Chehab  cstime        kernel mode jiffies with child's
351c33e97efSMauro Carvalho Chehab  priority      priority level
352c33e97efSMauro Carvalho Chehab  nice          nice level
353c33e97efSMauro Carvalho Chehab  num_threads   number of threads
354c33e97efSMauro Carvalho Chehab  it_real_value	(obsolete, always 0)
355c33e97efSMauro Carvalho Chehab  start_time    time the process started after system boot
356c33e97efSMauro Carvalho Chehab  vsize         virtual memory size
357c33e97efSMauro Carvalho Chehab  rss           resident set memory size
358c33e97efSMauro Carvalho Chehab  rsslim        current limit in bytes on the rss
359c33e97efSMauro Carvalho Chehab  start_code    address above which program text can run
360c33e97efSMauro Carvalho Chehab  end_code      address below which program text can run
361c33e97efSMauro Carvalho Chehab  start_stack   address of the start of the main process stack
362c33e97efSMauro Carvalho Chehab  esp           current value of ESP
363c33e97efSMauro Carvalho Chehab  eip           current value of EIP
364c33e97efSMauro Carvalho Chehab  pending       bitmap of pending signals
365c33e97efSMauro Carvalho Chehab  blocked       bitmap of blocked signals
366c33e97efSMauro Carvalho Chehab  sigign        bitmap of ignored signals
367c33e97efSMauro Carvalho Chehab  sigcatch      bitmap of caught signals
368c33e97efSMauro Carvalho Chehab  0		(place holder, used to be the wchan address,
369c33e97efSMauro Carvalho Chehab		use /proc/PID/wchan instead)
370c33e97efSMauro Carvalho Chehab  0             (place holder)
371c33e97efSMauro Carvalho Chehab  0             (place holder)
372c33e97efSMauro Carvalho Chehab  exit_signal   signal to send to parent thread on exit
373c33e97efSMauro Carvalho Chehab  task_cpu      which CPU the task is scheduled on
374c33e97efSMauro Carvalho Chehab  rt_priority   realtime priority
375c33e97efSMauro Carvalho Chehab  policy        scheduling policy (man sched_setscheduler)
376c33e97efSMauro Carvalho Chehab  blkio_ticks   time spent waiting for block IO
377c33e97efSMauro Carvalho Chehab  gtime         guest time of the task in jiffies
378c33e97efSMauro Carvalho Chehab  cgtime        guest time of the task children in jiffies
379c33e97efSMauro Carvalho Chehab  start_data    address above which program data+bss is placed
380c33e97efSMauro Carvalho Chehab  end_data      address below which program data+bss is placed
381c33e97efSMauro Carvalho Chehab  start_brk     address above which program heap can be expanded with brk()
382c33e97efSMauro Carvalho Chehab  arg_start     address above which program command line is placed
383c33e97efSMauro Carvalho Chehab  arg_end       address below which program command line is placed
384c33e97efSMauro Carvalho Chehab  env_start     address above which program environment is placed
385c33e97efSMauro Carvalho Chehab  env_end       address below which program environment is placed
386c33e97efSMauro Carvalho Chehab  exit_code     the thread's exit_code in the form reported by the waitpid
387c33e97efSMauro Carvalho Chehab		system call
388c33e97efSMauro Carvalho Chehab  ============= ===============================================================
389c33e97efSMauro Carvalho Chehab
390c33e97efSMauro Carvalho ChehabThe /proc/PID/maps file contains the currently mapped memory regions and
391c33e97efSMauro Carvalho Chehabtheir access permissions.
392c33e97efSMauro Carvalho Chehab
393c33e97efSMauro Carvalho ChehabThe format is::
394c33e97efSMauro Carvalho Chehab
395c33e97efSMauro Carvalho Chehab    address           perms offset  dev   inode      pathname
396c33e97efSMauro Carvalho Chehab
397c33e97efSMauro Carvalho Chehab    08048000-08049000 r-xp 00000000 03:00 8312       /opt/test
398c33e97efSMauro Carvalho Chehab    08049000-0804a000 rw-p 00001000 03:00 8312       /opt/test
399c33e97efSMauro Carvalho Chehab    0804a000-0806b000 rw-p 00000000 00:00 0          [heap]
400c33e97efSMauro Carvalho Chehab    a7cb1000-a7cb2000 ---p 00000000 00:00 0
401c33e97efSMauro Carvalho Chehab    a7cb2000-a7eb2000 rw-p 00000000 00:00 0
402c33e97efSMauro Carvalho Chehab    a7eb2000-a7eb3000 ---p 00000000 00:00 0
403c33e97efSMauro Carvalho Chehab    a7eb3000-a7ed5000 rw-p 00000000 00:00 0
404c33e97efSMauro Carvalho Chehab    a7ed5000-a8008000 r-xp 00000000 03:00 4222       /lib/libc.so.6
405c33e97efSMauro Carvalho Chehab    a8008000-a800a000 r--p 00133000 03:00 4222       /lib/libc.so.6
406c33e97efSMauro Carvalho Chehab    a800a000-a800b000 rw-p 00135000 03:00 4222       /lib/libc.so.6
407c33e97efSMauro Carvalho Chehab    a800b000-a800e000 rw-p 00000000 00:00 0
408c33e97efSMauro Carvalho Chehab    a800e000-a8022000 r-xp 00000000 03:00 14462      /lib/libpthread.so.0
409c33e97efSMauro Carvalho Chehab    a8022000-a8023000 r--p 00013000 03:00 14462      /lib/libpthread.so.0
410c33e97efSMauro Carvalho Chehab    a8023000-a8024000 rw-p 00014000 03:00 14462      /lib/libpthread.so.0
411c33e97efSMauro Carvalho Chehab    a8024000-a8027000 rw-p 00000000 00:00 0
412c33e97efSMauro Carvalho Chehab    a8027000-a8043000 r-xp 00000000 03:00 8317       /lib/ld-linux.so.2
413c33e97efSMauro Carvalho Chehab    a8043000-a8044000 r--p 0001b000 03:00 8317       /lib/ld-linux.so.2
414c33e97efSMauro Carvalho Chehab    a8044000-a8045000 rw-p 0001c000 03:00 8317       /lib/ld-linux.so.2
415c33e97efSMauro Carvalho Chehab    aff35000-aff4a000 rw-p 00000000 00:00 0          [stack]
416c33e97efSMauro Carvalho Chehab    ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
417c33e97efSMauro Carvalho Chehab
418c33e97efSMauro Carvalho Chehabwhere "address" is the address space in the process that it occupies, "perms"
419c33e97efSMauro Carvalho Chehabis a set of permissions::
420c33e97efSMauro Carvalho Chehab
421c33e97efSMauro Carvalho Chehab r = read
422c33e97efSMauro Carvalho Chehab w = write
423c33e97efSMauro Carvalho Chehab x = execute
424c33e97efSMauro Carvalho Chehab s = shared
425c33e97efSMauro Carvalho Chehab p = private (copy on write)
426c33e97efSMauro Carvalho Chehab
427c33e97efSMauro Carvalho Chehab"offset" is the offset into the mapping, "dev" is the device (major:minor), and
428c33e97efSMauro Carvalho Chehab"inode" is the inode  on that device.  0 indicates that  no inode is associated
429c33e97efSMauro Carvalho Chehabwith the memory region, as the case would be with BSS (uninitialized data).
430c33e97efSMauro Carvalho ChehabThe "pathname" shows the name associated file for this mapping.  If the mapping
431c33e97efSMauro Carvalho Chehabis not associated with a file:
432c33e97efSMauro Carvalho Chehab
433d09e8ca6SPasha Tatashin ===================        ===========================================
434c33e97efSMauro Carvalho Chehab [heap]                     the heap of the program
435c33e97efSMauro Carvalho Chehab [stack]                    the stack of the main process
436c33e97efSMauro Carvalho Chehab [vdso]                     the "virtual dynamic shared object",
437c33e97efSMauro Carvalho Chehab                            the kernel system call handler
438d09e8ca6SPasha Tatashin [anon:<name>]              a private anonymous mapping that has been
4399a10064fSColin Cross                            named by userspace
440d09e8ca6SPasha Tatashin [anon_shmem:<name>]        an anonymous shared memory mapping that has
441d09e8ca6SPasha Tatashin                            been named by userspace
442d09e8ca6SPasha Tatashin ===================        ===========================================
443c33e97efSMauro Carvalho Chehab
444c33e97efSMauro Carvalho Chehab or if empty, the mapping is anonymous.
445c33e97efSMauro Carvalho Chehab
446c33e97efSMauro Carvalho ChehabThe /proc/PID/smaps is an extension based on maps, showing the memory
447c33e97efSMauro Carvalho Chehabconsumption for each of the process's mappings. For each mapping (aka Virtual
448c33e97efSMauro Carvalho ChehabMemory Area, or VMA) there is a series of lines such as the following::
449c33e97efSMauro Carvalho Chehab
450c33e97efSMauro Carvalho Chehab    08048000-080bc000 r-xp 00000000 03:02 13130      /bin/bash
451c33e97efSMauro Carvalho Chehab
452c33e97efSMauro Carvalho Chehab    Size:               1084 kB
453c33e97efSMauro Carvalho Chehab    KernelPageSize:        4 kB
454c33e97efSMauro Carvalho Chehab    MMUPageSize:           4 kB
455c33e97efSMauro Carvalho Chehab    Rss:                 892 kB
456c33e97efSMauro Carvalho Chehab    Pss:                 374 kB
45730934843SVincent Whitchurch    Pss_Dirty:             0 kB
458c33e97efSMauro Carvalho Chehab    Shared_Clean:        892 kB
459c33e97efSMauro Carvalho Chehab    Shared_Dirty:          0 kB
460c33e97efSMauro Carvalho Chehab    Private_Clean:         0 kB
461c33e97efSMauro Carvalho Chehab    Private_Dirty:         0 kB
462c33e97efSMauro Carvalho Chehab    Referenced:          892 kB
463c33e97efSMauro Carvalho Chehab    Anonymous:             0 kB
4648b479335SStefan Roesch    KSM:                   0 kB
465c33e97efSMauro Carvalho Chehab    LazyFree:              0 kB
466c33e97efSMauro Carvalho Chehab    AnonHugePages:         0 kB
467c33e97efSMauro Carvalho Chehab    ShmemPmdMapped:        0 kB
468c33e97efSMauro Carvalho Chehab    Shared_Hugetlb:        0 kB
469c33e97efSMauro Carvalho Chehab    Private_Hugetlb:       0 kB
470c33e97efSMauro Carvalho Chehab    Swap:                  0 kB
471c33e97efSMauro Carvalho Chehab    SwapPss:               0 kB
472c33e97efSMauro Carvalho Chehab    KernelPageSize:        4 kB
473c33e97efSMauro Carvalho Chehab    MMUPageSize:           4 kB
474c33e97efSMauro Carvalho Chehab    Locked:                0 kB
475c33e97efSMauro Carvalho Chehab    THPeligible:           0
476c33e97efSMauro Carvalho Chehab    VmFlags: rd ex mr mw me dw
477c33e97efSMauro Carvalho Chehab
478c33e97efSMauro Carvalho ChehabThe first of these lines shows the same information as is displayed for the
479c33e97efSMauro Carvalho Chehabmapping in /proc/PID/maps.  Following lines show the size of the mapping
480c33e97efSMauro Carvalho Chehab(size); the size of each page allocated when backing a VMA (KernelPageSize),
481c33e97efSMauro Carvalho Chehabwhich is usually the same as the size in the page table entries; the page size
482c33e97efSMauro Carvalho Chehabused by the MMU when backing a VMA (in most cases, the same as KernelPageSize);
483c33e97efSMauro Carvalho Chehabthe amount of the mapping that is currently resident in RAM (RSS); the
484c33e97efSMauro Carvalho Chehabprocess' proportional share of this mapping (PSS); and the number of clean and
485c33e97efSMauro Carvalho Chehabdirty shared and private pages in the mapping.
486c33e97efSMauro Carvalho Chehab
487c33e97efSMauro Carvalho ChehabThe "proportional set size" (PSS) of a process is the count of pages it has
488c33e97efSMauro Carvalho Chehabin memory, where each page is divided by the number of processes sharing it.
489c33e97efSMauro Carvalho ChehabSo if a process has 1000 pages all to itself, and 1000 shared with one other
49030934843SVincent Whitchurchprocess, its PSS will be 1500.  "Pss_Dirty" is the portion of PSS which
49130934843SVincent Whitchurchconsists of dirty pages.  ("Pss_Clean" is not included, but it can be
49230934843SVincent Whitchurchcalculated by subtracting "Pss_Dirty" from "Pss".)
493c33e97efSMauro Carvalho Chehab
494c33e97efSMauro Carvalho ChehabNote that even a page which is part of a MAP_SHARED mapping, but has only
495c33e97efSMauro Carvalho Chehaba single pte mapped, i.e.  is currently used by only one process, is accounted
496c33e97efSMauro Carvalho Chehabas private and not as shared.
497c33e97efSMauro Carvalho Chehab
498c33e97efSMauro Carvalho Chehab"Referenced" indicates the amount of memory currently marked as referenced or
499c33e97efSMauro Carvalho Chehabaccessed.
500c33e97efSMauro Carvalho Chehab
501c33e97efSMauro Carvalho Chehab"Anonymous" shows the amount of memory that does not belong to any file.  Even
502c33e97efSMauro Carvalho Chehaba mapping associated with a file may contain anonymous pages: when MAP_PRIVATE
503c33e97efSMauro Carvalho Chehaband a page is modified, the file page is replaced by a private anonymous copy.
504c33e97efSMauro Carvalho Chehab
5058b479335SStefan Roesch"KSM" reports how many of the pages are KSM pages. Note that KSM-placed zeropages
5068b479335SStefan Roeschare not included, only actual KSM pages.
5078b479335SStefan Roesch
508c33e97efSMauro Carvalho Chehab"LazyFree" shows the amount of memory which is marked by madvise(MADV_FREE).
509c33e97efSMauro Carvalho ChehabThe memory isn't freed immediately with madvise(). It's freed in memory
510c33e97efSMauro Carvalho Chehabpressure if the memory is clean. Please note that the printed value might
511c33e97efSMauro Carvalho Chehabbe lower than the real value due to optimizations used in the current
512c33e97efSMauro Carvalho Chehabimplementation. If this is not desirable please file a bug report.
513c33e97efSMauro Carvalho Chehab
514d56b699dSBjorn Helgaas"AnonHugePages" shows the amount of memory backed by transparent hugepage.
515c33e97efSMauro Carvalho Chehab
516d56b699dSBjorn Helgaas"ShmemPmdMapped" shows the amount of shared (shmem/tmpfs) memory backed by
517c33e97efSMauro Carvalho Chehabhuge pages.
518c33e97efSMauro Carvalho Chehab
519d56b699dSBjorn Helgaas"Shared_Hugetlb" and "Private_Hugetlb" show the amounts of memory backed by
520c33e97efSMauro Carvalho Chehabhugetlbfs page which is *not* counted in "RSS" or "PSS" field for historical
521c33e97efSMauro Carvalho Chehabreasons. And these are not included in {Shared,Private}_{Clean,Dirty} field.
522c33e97efSMauro Carvalho Chehab
523c33e97efSMauro Carvalho Chehab"Swap" shows how much would-be-anonymous memory is also used, but out on swap.
524c33e97efSMauro Carvalho Chehab
525c33e97efSMauro Carvalho ChehabFor shmem mappings, "Swap" includes also the size of the mapped (and not
526c33e97efSMauro Carvalho Chehabreplaced by copy-on-write) part of the underlying shmem object out on swap.
527c33e97efSMauro Carvalho Chehab"SwapPss" shows proportional swap share of this mapping. Unlike "Swap", this
528c33e97efSMauro Carvalho Chehabdoes not take into account swapped out page of underlying shmem objects.
529c33e97efSMauro Carvalho Chehab"Locked" indicates whether the mapping is locked in memory or not.
530cb55b838SYang Shi
5313485b883SRyan Roberts"THPeligible" indicates whether the mapping is eligible for allocating
5323485b883SRyan Robertsnaturally aligned THP pages of any currently enabled size. 1 if true, 0
5333485b883SRyan Robertsotherwise.
534c33e97efSMauro Carvalho Chehab
535c33e97efSMauro Carvalho Chehab"VmFlags" field deserves a separate description. This member represents the
536c33e97efSMauro Carvalho Chehabkernel flags associated with the particular virtual memory area in two letter
537c33e97efSMauro Carvalho Chehabencoded manner. The codes are the following:
538c33e97efSMauro Carvalho Chehab
539c33e97efSMauro Carvalho Chehab    ==    =======================================
540c33e97efSMauro Carvalho Chehab    rd    readable
541c33e97efSMauro Carvalho Chehab    wr    writeable
542c33e97efSMauro Carvalho Chehab    ex    executable
543c33e97efSMauro Carvalho Chehab    sh    shared
544c33e97efSMauro Carvalho Chehab    mr    may read
545c33e97efSMauro Carvalho Chehab    mw    may write
546c33e97efSMauro Carvalho Chehab    me    may execute
547c33e97efSMauro Carvalho Chehab    ms    may share
548c33e97efSMauro Carvalho Chehab    gd    stack segment growns down
549c33e97efSMauro Carvalho Chehab    pf    pure PFN range
550c33e97efSMauro Carvalho Chehab    dw    disabled write to the mapped file
551c33e97efSMauro Carvalho Chehab    lo    pages are locked in memory
552c33e97efSMauro Carvalho Chehab    io    memory mapped I/O area
553c33e97efSMauro Carvalho Chehab    sr    sequential read advise provided
554c33e97efSMauro Carvalho Chehab    rr    random read advise provided
555c33e97efSMauro Carvalho Chehab    dc    do not copy area on fork
556c33e97efSMauro Carvalho Chehab    de    do not expand area on remapping
557c33e97efSMauro Carvalho Chehab    ac    area is accountable
558c33e97efSMauro Carvalho Chehab    nr    swap space is not reserved for the area
559c33e97efSMauro Carvalho Chehab    ht    area uses huge tlb pages
5601f7faca2SPeter Xu    sf    synchronous page fault
561c33e97efSMauro Carvalho Chehab    ar    architecture specific flag
5621f7faca2SPeter Xu    wf    wipe on fork
563c33e97efSMauro Carvalho Chehab    dd    do not include area into core dump
564c33e97efSMauro Carvalho Chehab    sd    soft dirty flag
565c33e97efSMauro Carvalho Chehab    mm    mixed map area
566c33e97efSMauro Carvalho Chehab    hg    huge page advise flag
567c33e97efSMauro Carvalho Chehab    nh    no huge page advise flag
568d56b699dSBjorn Helgaas    mg    mergeable advise flag
569d5ddc6d9SMauro Carvalho Chehab    bt    arm64 BTI guarded page
570868770c9SSzabolcs Nagy    mt    arm64 MTE allocation tags are enabled
5711f7faca2SPeter Xu    um    userfaultfd missing tracking
5721f7faca2SPeter Xu    uw    userfaultfd wr-protect tracking
57354007f81SYu-cheng Yu    ss    shadow stack page
574c33e97efSMauro Carvalho Chehab    ==    =======================================
575c33e97efSMauro Carvalho Chehab
576c33e97efSMauro Carvalho ChehabNote that there is no guarantee that every flag and associated mnemonic will
577c33e97efSMauro Carvalho Chehabbe present in all further kernel releases. Things get changed, the flags may
578c33e97efSMauro Carvalho Chehabbe vanished or the reverse -- new added. Interpretation of their meaning
579c33e97efSMauro Carvalho Chehabmight change in future as well. So each consumer of these flags has to
580c33e97efSMauro Carvalho Chehabfollow each specific kernel version for the exact semantic.
581c33e97efSMauro Carvalho Chehab
582c33e97efSMauro Carvalho ChehabThis file is only present if the CONFIG_MMU kernel configuration option is
583c33e97efSMauro Carvalho Chehabenabled.
584c33e97efSMauro Carvalho Chehab
585c33e97efSMauro Carvalho ChehabNote: reading /proc/PID/maps or /proc/PID/smaps is inherently racy (consistent
586c33e97efSMauro Carvalho Chehaboutput can be achieved only in the single read call).
587c33e97efSMauro Carvalho Chehab
588c33e97efSMauro Carvalho ChehabThis typically manifests when doing partial reads of these files while the
589c33e97efSMauro Carvalho Chehabmemory map is being modified.  Despite the races, we do provide the following
590c33e97efSMauro Carvalho Chehabguarantees:
591c33e97efSMauro Carvalho Chehab
592c33e97efSMauro Carvalho Chehab1) The mapped addresses never go backwards, which implies no two
593c33e97efSMauro Carvalho Chehab   regions will ever overlap.
594c33e97efSMauro Carvalho Chehab2) If there is something at a given vaddr during the entirety of the
595c33e97efSMauro Carvalho Chehab   life of the smaps/maps walk, there will be some output for it.
596c33e97efSMauro Carvalho Chehab
597c33e97efSMauro Carvalho ChehabThe /proc/PID/smaps_rollup file includes the same fields as /proc/PID/smaps,
598c33e97efSMauro Carvalho Chehabbut their values are the sums of the corresponding values for all mappings of
599c33e97efSMauro Carvalho Chehabthe process.  Additionally, it contains these fields:
600c33e97efSMauro Carvalho Chehab
601c33e97efSMauro Carvalho Chehab- Pss_Anon
602c33e97efSMauro Carvalho Chehab- Pss_File
603c33e97efSMauro Carvalho Chehab- Pss_Shmem
604c33e97efSMauro Carvalho Chehab
605c33e97efSMauro Carvalho ChehabThey represent the proportional shares of anonymous, file, and shmem pages, as
606c33e97efSMauro Carvalho Chehabdescribed for smaps above.  These fields are omitted in smaps since each
607c33e97efSMauro Carvalho Chehabmapping identifies the type (anon, file, or shmem) of all pages it contains.
608c33e97efSMauro Carvalho ChehabThus all information in smaps_rollup can be derived from smaps, but at a
609c33e97efSMauro Carvalho Chehabsignificantly higher cost.
610c33e97efSMauro Carvalho Chehab
611c33e97efSMauro Carvalho ChehabThe /proc/PID/clear_refs is used to reset the PG_Referenced and ACCESSED/YOUNG
612c33e97efSMauro Carvalho Chehabbits on both physical and virtual pages associated with a process, and the
613c33e97efSMauro Carvalho Chehabsoft-dirty bit on pte (see Documentation/admin-guide/mm/soft-dirty.rst
614c33e97efSMauro Carvalho Chehabfor details).
615c33e97efSMauro Carvalho ChehabTo clear the bits for all the pages associated with the process::
616c33e97efSMauro Carvalho Chehab
617c33e97efSMauro Carvalho Chehab    > echo 1 > /proc/PID/clear_refs
618c33e97efSMauro Carvalho Chehab
619c33e97efSMauro Carvalho ChehabTo clear the bits for the anonymous pages associated with the process::
620c33e97efSMauro Carvalho Chehab
621c33e97efSMauro Carvalho Chehab    > echo 2 > /proc/PID/clear_refs
622c33e97efSMauro Carvalho Chehab
623c33e97efSMauro Carvalho ChehabTo clear the bits for the file mapped pages associated with the process::
624c33e97efSMauro Carvalho Chehab
625c33e97efSMauro Carvalho Chehab    > echo 3 > /proc/PID/clear_refs
626c33e97efSMauro Carvalho Chehab
627c33e97efSMauro Carvalho ChehabTo clear the soft-dirty bit::
628c33e97efSMauro Carvalho Chehab
629c33e97efSMauro Carvalho Chehab    > echo 4 > /proc/PID/clear_refs
630c33e97efSMauro Carvalho Chehab
631c33e97efSMauro Carvalho ChehabTo reset the peak resident set size ("high water mark") to the process's
632c33e97efSMauro Carvalho Chehabcurrent value::
633c33e97efSMauro Carvalho Chehab
634c33e97efSMauro Carvalho Chehab    > echo 5 > /proc/PID/clear_refs
635c33e97efSMauro Carvalho Chehab
636c33e97efSMauro Carvalho ChehabAny other value written to /proc/PID/clear_refs will have no effect.
637c33e97efSMauro Carvalho Chehab
638c33e97efSMauro Carvalho ChehabThe /proc/pid/pagemap gives the PFN, which can be used to find the pageflags
639c33e97efSMauro Carvalho Chehabusing /proc/kpageflags and number of times a page is mapped using
640c33e97efSMauro Carvalho Chehab/proc/kpagecount. For detailed explanation, see
641c33e97efSMauro Carvalho ChehabDocumentation/admin-guide/mm/pagemap.rst.
642c33e97efSMauro Carvalho Chehab
643c33e97efSMauro Carvalho ChehabThe /proc/pid/numa_maps is an extension based on maps, showing the memory
644c33e97efSMauro Carvalho Chehablocality and binding policy, as well as the memory usage (in pages) of
645c33e97efSMauro Carvalho Chehabeach mapping. The output follows a general format where mapping details get
646c33e97efSMauro Carvalho Chehabsummarized separated by blank spaces, one mapping per each file line::
647c33e97efSMauro Carvalho Chehab
648c33e97efSMauro Carvalho Chehab    address   policy    mapping details
649c33e97efSMauro Carvalho Chehab
650c33e97efSMauro Carvalho Chehab    00400000 default file=/usr/local/bin/app mapped=1 active=0 N3=1 kernelpagesize_kB=4
651c33e97efSMauro Carvalho Chehab    00600000 default file=/usr/local/bin/app anon=1 dirty=1 N3=1 kernelpagesize_kB=4
652c33e97efSMauro Carvalho Chehab    3206000000 default file=/lib64/ld-2.12.so mapped=26 mapmax=6 N0=24 N3=2 kernelpagesize_kB=4
653c33e97efSMauro Carvalho Chehab    320621f000 default file=/lib64/ld-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
654c33e97efSMauro Carvalho Chehab    3206220000 default file=/lib64/ld-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
655c33e97efSMauro Carvalho Chehab    3206221000 default anon=1 dirty=1 N3=1 kernelpagesize_kB=4
656c33e97efSMauro Carvalho Chehab    3206800000 default file=/lib64/libc-2.12.so mapped=59 mapmax=21 active=55 N0=41 N3=18 kernelpagesize_kB=4
657c33e97efSMauro Carvalho Chehab    320698b000 default file=/lib64/libc-2.12.so
658c33e97efSMauro Carvalho Chehab    3206b8a000 default file=/lib64/libc-2.12.so anon=2 dirty=2 N3=2 kernelpagesize_kB=4
659c33e97efSMauro Carvalho Chehab    3206b8e000 default file=/lib64/libc-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
660c33e97efSMauro Carvalho Chehab    3206b8f000 default anon=3 dirty=3 active=1 N3=3 kernelpagesize_kB=4
661c33e97efSMauro Carvalho Chehab    7f4dc10a2000 default anon=3 dirty=3 N3=3 kernelpagesize_kB=4
662c33e97efSMauro Carvalho Chehab    7f4dc10b4000 default anon=2 dirty=2 active=1 N3=2 kernelpagesize_kB=4
663c33e97efSMauro Carvalho Chehab    7f4dc1200000 default file=/anon_hugepage\040(deleted) huge anon=1 dirty=1 N3=1 kernelpagesize_kB=2048
664c33e97efSMauro Carvalho Chehab    7fff335f0000 default stack anon=3 dirty=3 N3=3 kernelpagesize_kB=4
665c33e97efSMauro Carvalho Chehab    7fff3369d000 default mapped=1 mapmax=35 active=0 N3=1 kernelpagesize_kB=4
666c33e97efSMauro Carvalho Chehab
667c33e97efSMauro Carvalho ChehabWhere:
668c33e97efSMauro Carvalho Chehab
669c33e97efSMauro Carvalho Chehab"address" is the starting address for the mapping;
670c33e97efSMauro Carvalho Chehab
671c33e97efSMauro Carvalho Chehab"policy" reports the NUMA memory policy set for the mapping (see Documentation/admin-guide/mm/numa_memory_policy.rst);
672c33e97efSMauro Carvalho Chehab
673c33e97efSMauro Carvalho Chehab"mapping details" summarizes mapping data such as mapping type, page usage counters,
674c33e97efSMauro Carvalho Chehabnode locality page counters (N0 == node0, N1 == node1, ...) and the kernel page
675c33e97efSMauro Carvalho Chehabsize, in KB, that is backing the mapping up.
676c33e97efSMauro Carvalho Chehab
677c33e97efSMauro Carvalho Chehab1.2 Kernel data
678c33e97efSMauro Carvalho Chehab---------------
679c33e97efSMauro Carvalho Chehab
680c33e97efSMauro Carvalho ChehabSimilar to  the  process entries, the kernel data files give information about
681c33e97efSMauro Carvalho Chehabthe running kernel. The files used to obtain this information are contained in
682c33e97efSMauro Carvalho Chehab/proc and  are  listed  in Table 1-5. Not all of these will be present in your
683c33e97efSMauro Carvalho Chehabsystem. It  depends  on the kernel configuration and the loaded modules, which
684c33e97efSMauro Carvalho Chehabfiles are there, and which are missing.
685c33e97efSMauro Carvalho Chehab
686c33e97efSMauro Carvalho Chehab.. table:: Table 1-5: Kernel info in /proc
687c33e97efSMauro Carvalho Chehab
688c33e97efSMauro Carvalho Chehab ============ ===============================================================
689c33e97efSMauro Carvalho Chehab File         Content
690c33e97efSMauro Carvalho Chehab ============ ===============================================================
691*22d407b1SSuren Baghdasaryan allocinfo    Memory allocations profiling information
692c33e97efSMauro Carvalho Chehab apm          Advanced power management info
693acbc3ecbSPaul E. McKenney bootconfig   Kernel command line obtained from boot config,
694acbc3ecbSPaul E. McKenney 	      and, if there were kernel parameters from the
695acbc3ecbSPaul E. McKenney	      boot loader, a "# Parameters from bootloader:"
696acbc3ecbSPaul E. McKenney	      line followed by a line containing those
697acbc3ecbSPaul E. McKenney	      parameters prefixed by "# ".			(5.5)
698c33e97efSMauro Carvalho Chehab buddyinfo    Kernel memory allocator information (see text)	(2.5)
699c33e97efSMauro Carvalho Chehab bus          Directory containing bus specific information
7001c20c65eSPaul E. McKenney cmdline      Kernel command line, both from bootloader and embedded
7011c20c65eSPaul E. McKenney              in the kernel image
702c33e97efSMauro Carvalho Chehab cpuinfo      Info about the CPU
703c33e97efSMauro Carvalho Chehab devices      Available devices (block and character)
704c33e97efSMauro Carvalho Chehab dma          Used DMS channels
705c33e97efSMauro Carvalho Chehab filesystems  Supported filesystems
706c33e97efSMauro Carvalho Chehab driver       Various drivers grouped here, currently rtc	(2.4)
707c33e97efSMauro Carvalho Chehab execdomains  Execdomains, related to security			(2.4)
708c33e97efSMauro Carvalho Chehab fb 	      Frame Buffer devices				(2.4)
709c33e97efSMauro Carvalho Chehab fs 	      File system parameters, currently nfs/exports	(2.4)
710c33e97efSMauro Carvalho Chehab ide          Directory containing info about the IDE subsystem
711c33e97efSMauro Carvalho Chehab interrupts   Interrupt usage
712c33e97efSMauro Carvalho Chehab iomem 	      Memory map					(2.4)
713c33e97efSMauro Carvalho Chehab ioports      I/O port usage
714c33e97efSMauro Carvalho Chehab irq 	      Masks for irq to cpu affinity			(2.4)(smp?)
715c33e97efSMauro Carvalho Chehab isapnp       ISA PnP (Plug&Play) Info				(2.4)
716c33e97efSMauro Carvalho Chehab kcore        Kernel core image (can be ELF or A.OUT(deprecated in 2.4))
717c33e97efSMauro Carvalho Chehab kmsg         Kernel messages
718c33e97efSMauro Carvalho Chehab ksyms        Kernel symbol table
7194ba1d726SRandy Dunlap loadavg      Load average of last 1, 5 & 15 minutes;
7204ba1d726SRandy Dunlap                number of processes currently runnable (running or on ready queue);
7214ba1d726SRandy Dunlap                total number of processes in system;
7224ba1d726SRandy Dunlap                last pid created.
72393ea4a0bSRandy Dunlap                All fields are separated by one space except "number of
72493ea4a0bSRandy Dunlap                processes currently runnable" and "total number of processes
72593ea4a0bSRandy Dunlap                in system", which are separated by a slash ('/'). Example:
72693ea4a0bSRandy Dunlap                0.61 0.61 0.55 3/828 22084
727c33e97efSMauro Carvalho Chehab locks        Kernel locks
728c33e97efSMauro Carvalho Chehab meminfo      Memory info
729c33e97efSMauro Carvalho Chehab misc         Miscellaneous
730c33e97efSMauro Carvalho Chehab modules      List of loaded modules
731c33e97efSMauro Carvalho Chehab mounts       Mounted filesystems
732c33e97efSMauro Carvalho Chehab net          Networking info (see text)
733c33e97efSMauro Carvalho Chehab pagetypeinfo Additional page allocator information (see text)  (2.5)
734c33e97efSMauro Carvalho Chehab partitions   Table of partitions known to the system
735c33e97efSMauro Carvalho Chehab pci 	      Deprecated info of PCI bus (new way -> /proc/bus/pci/,
736c33e97efSMauro Carvalho Chehab              decoupled by lspci				(2.4)
737c33e97efSMauro Carvalho Chehab rtc          Real time clock
738c33e97efSMauro Carvalho Chehab scsi         SCSI info (see text)
739c33e97efSMauro Carvalho Chehab slabinfo     Slab pool info
740c33e97efSMauro Carvalho Chehab softirqs     softirq usage
741c33e97efSMauro Carvalho Chehab stat         Overall statistics
742c33e97efSMauro Carvalho Chehab swaps        Swap space utilization
743c33e97efSMauro Carvalho Chehab sys          See chapter 2
744c33e97efSMauro Carvalho Chehab sysvipc      Info of SysVIPC Resources (msg, sem, shm)		(2.4)
745c33e97efSMauro Carvalho Chehab tty 	      Info of tty drivers
746c33e97efSMauro Carvalho Chehab uptime       Wall clock since boot, combined idle time of all cpus
747c33e97efSMauro Carvalho Chehab version      Kernel version
748c33e97efSMauro Carvalho Chehab video 	      bttv info of video resources			(2.4)
749c33e97efSMauro Carvalho Chehab vmallocinfo  Show vmalloced areas
750c33e97efSMauro Carvalho Chehab ============ ===============================================================
751c33e97efSMauro Carvalho Chehab
752c33e97efSMauro Carvalho ChehabYou can,  for  example,  check  which interrupts are currently in use and what
753c33e97efSMauro Carvalho Chehabthey are used for by looking in the file /proc/interrupts::
754c33e97efSMauro Carvalho Chehab
755c33e97efSMauro Carvalho Chehab  > cat /proc/interrupts
756c33e97efSMauro Carvalho Chehab             CPU0
757c33e97efSMauro Carvalho Chehab    0:    8728810          XT-PIC  timer
758c33e97efSMauro Carvalho Chehab    1:        895          XT-PIC  keyboard
759c33e97efSMauro Carvalho Chehab    2:          0          XT-PIC  cascade
760c33e97efSMauro Carvalho Chehab    3:     531695          XT-PIC  aha152x
761c33e97efSMauro Carvalho Chehab    4:    2014133          XT-PIC  serial
762c33e97efSMauro Carvalho Chehab    5:      44401          XT-PIC  pcnet_cs
763c33e97efSMauro Carvalho Chehab    8:          2          XT-PIC  rtc
764c33e97efSMauro Carvalho Chehab   11:          8          XT-PIC  i82365
765c33e97efSMauro Carvalho Chehab   12:     182918          XT-PIC  PS/2 Mouse
766c33e97efSMauro Carvalho Chehab   13:          1          XT-PIC  fpu
767c33e97efSMauro Carvalho Chehab   14:    1232265          XT-PIC  ide0
768c33e97efSMauro Carvalho Chehab   15:          7          XT-PIC  ide1
769c33e97efSMauro Carvalho Chehab  NMI:          0
770c33e97efSMauro Carvalho Chehab
771c33e97efSMauro Carvalho ChehabIn 2.4.* a couple of lines where added to this file LOC & ERR (this time is the
772c33e97efSMauro Carvalho Chehaboutput of a SMP machine)::
773c33e97efSMauro Carvalho Chehab
774c33e97efSMauro Carvalho Chehab  > cat /proc/interrupts
775c33e97efSMauro Carvalho Chehab
776c33e97efSMauro Carvalho Chehab             CPU0       CPU1
777c33e97efSMauro Carvalho Chehab    0:    1243498    1214548    IO-APIC-edge  timer
778c33e97efSMauro Carvalho Chehab    1:       8949       8958    IO-APIC-edge  keyboard
779c33e97efSMauro Carvalho Chehab    2:          0          0          XT-PIC  cascade
780c33e97efSMauro Carvalho Chehab    5:      11286      10161    IO-APIC-edge  soundblaster
781c33e97efSMauro Carvalho Chehab    8:          1          0    IO-APIC-edge  rtc
782c33e97efSMauro Carvalho Chehab    9:      27422      27407    IO-APIC-edge  3c503
783c33e97efSMauro Carvalho Chehab   12:     113645     113873    IO-APIC-edge  PS/2 Mouse
784c33e97efSMauro Carvalho Chehab   13:          0          0          XT-PIC  fpu
785c33e97efSMauro Carvalho Chehab   14:      22491      24012    IO-APIC-edge  ide0
786c33e97efSMauro Carvalho Chehab   15:       2183       2415    IO-APIC-edge  ide1
787c33e97efSMauro Carvalho Chehab   17:      30564      30414   IO-APIC-level  eth0
788c33e97efSMauro Carvalho Chehab   18:        177        164   IO-APIC-level  bttv
789c33e97efSMauro Carvalho Chehab  NMI:    2457961    2457959
790c33e97efSMauro Carvalho Chehab  LOC:    2457882    2457881
791c33e97efSMauro Carvalho Chehab  ERR:       2155
792c33e97efSMauro Carvalho Chehab
793c33e97efSMauro Carvalho ChehabNMI is incremented in this case because every timer interrupt generates a NMI
794c33e97efSMauro Carvalho Chehab(Non Maskable Interrupt) which is used by the NMI Watchdog to detect lockups.
795c33e97efSMauro Carvalho Chehab
796c33e97efSMauro Carvalho ChehabLOC is the local interrupt counter of the internal APIC of every CPU.
797c33e97efSMauro Carvalho Chehab
798c33e97efSMauro Carvalho ChehabERR is incremented in the case of errors in the IO-APIC bus (the bus that
799c33e97efSMauro Carvalho Chehabconnects the CPUs in a SMP system. This means that an error has been detected,
800c33e97efSMauro Carvalho Chehabthe IO-APIC automatically retry the transmission, so it should not be a big
801c33e97efSMauro Carvalho Chehabproblem, but you should read the SMP-FAQ.
802c33e97efSMauro Carvalho Chehab
803c33e97efSMauro Carvalho ChehabIn 2.6.2* /proc/interrupts was expanded again.  This time the goal was for
804c33e97efSMauro Carvalho Chehab/proc/interrupts to display every IRQ vector in use by the system, not
805c33e97efSMauro Carvalho Chehabjust those considered 'most important'.  The new vectors are:
806c33e97efSMauro Carvalho Chehab
807c33e97efSMauro Carvalho ChehabTHR
808c33e97efSMauro Carvalho Chehab  interrupt raised when a machine check threshold counter
809c33e97efSMauro Carvalho Chehab  (typically counting ECC corrected errors of memory or cache) exceeds
810c33e97efSMauro Carvalho Chehab  a configurable threshold.  Only available on some systems.
811c33e97efSMauro Carvalho Chehab
812c33e97efSMauro Carvalho ChehabTRM
813c33e97efSMauro Carvalho Chehab  a thermal event interrupt occurs when a temperature threshold
814c33e97efSMauro Carvalho Chehab  has been exceeded for the CPU.  This interrupt may also be generated
815c33e97efSMauro Carvalho Chehab  when the temperature drops back to normal.
816c33e97efSMauro Carvalho Chehab
817c33e97efSMauro Carvalho ChehabSPU
818c33e97efSMauro Carvalho Chehab  a spurious interrupt is some interrupt that was raised then lowered
819c33e97efSMauro Carvalho Chehab  by some IO device before it could be fully processed by the APIC.  Hence
820c33e97efSMauro Carvalho Chehab  the APIC sees the interrupt but does not know what device it came from.
821c33e97efSMauro Carvalho Chehab  For this case the APIC will generate the interrupt with a IRQ vector
822c33e97efSMauro Carvalho Chehab  of 0xff. This might also be generated by chipset bugs.
823c33e97efSMauro Carvalho Chehab
824059db434SRandy DunlapRES, CAL, TLB
825c33e97efSMauro Carvalho Chehab  rescheduling, call and TLB flush interrupts are
826c33e97efSMauro Carvalho Chehab  sent from one CPU to another per the needs of the OS.  Typically,
827c33e97efSMauro Carvalho Chehab  their statistics are used by kernel developers and interested users to
828c33e97efSMauro Carvalho Chehab  determine the occurrence of interrupts of the given type.
829c33e97efSMauro Carvalho Chehab
830c33e97efSMauro Carvalho ChehabThe above IRQ vectors are displayed only when relevant.  For example,
831c33e97efSMauro Carvalho Chehabthe threshold vector does not exist on x86_64 platforms.  Others are
832c33e97efSMauro Carvalho Chehabsuppressed when the system is a uniprocessor.  As of this writing, only
833c33e97efSMauro Carvalho Chehabi386 and x86_64 platforms support the new IRQ vector displays.
834c33e97efSMauro Carvalho Chehab
835c33e97efSMauro Carvalho ChehabOf some interest is the introduction of the /proc/irq directory to 2.4.
836059db434SRandy DunlapIt could be used to set IRQ to CPU affinity. This means that you can "hook" an
837c33e97efSMauro Carvalho ChehabIRQ to only one CPU, or to exclude a CPU of handling IRQs. The contents of the
838c33e97efSMauro Carvalho Chehabirq subdir is one subdir for each IRQ, and two files; default_smp_affinity and
839c33e97efSMauro Carvalho Chehabprof_cpu_mask.
840c33e97efSMauro Carvalho Chehab
841c33e97efSMauro Carvalho ChehabFor example::
842c33e97efSMauro Carvalho Chehab
843c33e97efSMauro Carvalho Chehab  > ls /proc/irq/
844c33e97efSMauro Carvalho Chehab  0  10  12  14  16  18  2  4  6  8  prof_cpu_mask
845c33e97efSMauro Carvalho Chehab  1  11  13  15  17  19  3  5  7  9  default_smp_affinity
846c33e97efSMauro Carvalho Chehab  > ls /proc/irq/0/
847c33e97efSMauro Carvalho Chehab  smp_affinity
848c33e97efSMauro Carvalho Chehab
849c33e97efSMauro Carvalho Chehabsmp_affinity is a bitmask, in which you can specify which CPUs can handle the
850059db434SRandy DunlapIRQ. You can set it by doing::
851c33e97efSMauro Carvalho Chehab
852c33e97efSMauro Carvalho Chehab  > echo 1 > /proc/irq/10/smp_affinity
853c33e97efSMauro Carvalho Chehab
854c33e97efSMauro Carvalho ChehabThis means that only the first CPU will handle the IRQ, but you can also echo
855c33e97efSMauro Carvalho Chehab5 which means that only the first and third CPU can handle the IRQ.
856c33e97efSMauro Carvalho Chehab
857c33e97efSMauro Carvalho ChehabThe contents of each smp_affinity file is the same by default::
858c33e97efSMauro Carvalho Chehab
859c33e97efSMauro Carvalho Chehab  > cat /proc/irq/0/smp_affinity
860c33e97efSMauro Carvalho Chehab  ffffffff
861c33e97efSMauro Carvalho Chehab
862c33e97efSMauro Carvalho ChehabThere is an alternate interface, smp_affinity_list which allows specifying
863059db434SRandy Dunlapa CPU range instead of a bitmask::
864c33e97efSMauro Carvalho Chehab
865c33e97efSMauro Carvalho Chehab  > cat /proc/irq/0/smp_affinity_list
866c33e97efSMauro Carvalho Chehab  1024-1031
867c33e97efSMauro Carvalho Chehab
868c33e97efSMauro Carvalho ChehabThe default_smp_affinity mask applies to all non-active IRQs, which are the
869c33e97efSMauro Carvalho ChehabIRQs which have not yet been allocated/activated, and hence which lack a
870c33e97efSMauro Carvalho Chehab/proc/irq/[0-9]* directory.
871c33e97efSMauro Carvalho Chehab
872c33e97efSMauro Carvalho ChehabThe node file on an SMP system shows the node to which the device using the IRQ
873c33e97efSMauro Carvalho Chehabreports itself as being attached. This hardware locality information does not
874c33e97efSMauro Carvalho Chehabinclude information about any possible driver locality preference.
875c33e97efSMauro Carvalho Chehab
876c33e97efSMauro Carvalho Chehabprof_cpu_mask specifies which CPUs are to be profiled by the system wide
877059db434SRandy Dunlapprofiler. Default value is ffffffff (all CPUs if there are only 32 of them).
878c33e97efSMauro Carvalho Chehab
879c33e97efSMauro Carvalho ChehabThe way IRQs are routed is handled by the IO-APIC, and it's Round Robin
880c33e97efSMauro Carvalho Chehabbetween all the CPUs which are allowed to handle it. As usual the kernel has
881c33e97efSMauro Carvalho Chehabmore info than you and does a better job than you, so the defaults are the
882c33e97efSMauro Carvalho Chehabbest choice for almost everyone.  [Note this applies only to those IO-APIC's
883c33e97efSMauro Carvalho Chehabthat support "Round Robin" interrupt distribution.]
884c33e97efSMauro Carvalho Chehab
885c33e97efSMauro Carvalho ChehabThere are  three  more  important subdirectories in /proc: net, scsi, and sys.
886c33e97efSMauro Carvalho ChehabThe general  rule  is  that  the  contents,  or  even  the  existence of these
887c33e97efSMauro Carvalho Chehabdirectories, depend  on your kernel configuration. If SCSI is not enabled, the
888c33e97efSMauro Carvalho Chehabdirectory scsi  may  not  exist. The same is true with the net, which is there
889c33e97efSMauro Carvalho Chehabonly when networking support is present in the running kernel.
890c33e97efSMauro Carvalho Chehab
891c33e97efSMauro Carvalho ChehabThe slabinfo  file  gives  information  about  memory usage at the slab level.
892c33e97efSMauro Carvalho ChehabLinux uses  slab  pools for memory management above page level in version 2.2.
893c33e97efSMauro Carvalho ChehabCommonly used  objects  have  their  own  slab  pool (such as network buffers,
894c33e97efSMauro Carvalho Chehabdirectory cache, and so on).
895c33e97efSMauro Carvalho Chehab
896c33e97efSMauro Carvalho Chehab::
897c33e97efSMauro Carvalho Chehab
898c33e97efSMauro Carvalho Chehab    > cat /proc/buddyinfo
899c33e97efSMauro Carvalho Chehab
900c33e97efSMauro Carvalho Chehab    Node 0, zone      DMA      0      4      5      4      4      3 ...
901c33e97efSMauro Carvalho Chehab    Node 0, zone   Normal      1      0      0      1    101      8 ...
902c33e97efSMauro Carvalho Chehab    Node 0, zone  HighMem      2      0      0      1      1      0 ...
903c33e97efSMauro Carvalho Chehab
904c33e97efSMauro Carvalho ChehabExternal fragmentation is a problem under some workloads, and buddyinfo is a
905c33e97efSMauro Carvalho Chehabuseful tool for helping diagnose these problems.  Buddyinfo will give you a
906c33e97efSMauro Carvalho Chehabclue as to how big an area you can safely allocate, or why a previous
907c33e97efSMauro Carvalho Chehaballocation failed.
908c33e97efSMauro Carvalho Chehab
909c33e97efSMauro Carvalho ChehabEach column represents the number of pages of a certain order which are
910c33e97efSMauro Carvalho Chehabavailable.  In this case, there are 0 chunks of 2^0*PAGE_SIZE available in
911c33e97efSMauro Carvalho ChehabZONE_DMA, 4 chunks of 2^1*PAGE_SIZE in ZONE_DMA, 101 chunks of 2^4*PAGE_SIZE
912c33e97efSMauro Carvalho Chehabavailable in ZONE_NORMAL, etc...
913c33e97efSMauro Carvalho Chehab
914c33e97efSMauro Carvalho ChehabMore information relevant to external fragmentation can be found in
915c33e97efSMauro Carvalho Chehabpagetypeinfo::
916c33e97efSMauro Carvalho Chehab
917c33e97efSMauro Carvalho Chehab    > cat /proc/pagetypeinfo
918c33e97efSMauro Carvalho Chehab    Page block order: 9
919c33e97efSMauro Carvalho Chehab    Pages per block:  512
920c33e97efSMauro Carvalho Chehab
921c33e97efSMauro Carvalho Chehab    Free pages count per migrate type at order       0      1      2      3      4      5      6      7      8      9     10
922c33e97efSMauro Carvalho Chehab    Node    0, zone      DMA, type    Unmovable      0      0      0      1      1      1      1      1      1      1      0
923c33e97efSMauro Carvalho Chehab    Node    0, zone      DMA, type  Reclaimable      0      0      0      0      0      0      0      0      0      0      0
924c33e97efSMauro Carvalho Chehab    Node    0, zone      DMA, type      Movable      1      1      2      1      2      1      1      0      1      0      2
925c33e97efSMauro Carvalho Chehab    Node    0, zone      DMA, type      Reserve      0      0      0      0      0      0      0      0      0      1      0
926c33e97efSMauro Carvalho Chehab    Node    0, zone      DMA, type      Isolate      0      0      0      0      0      0      0      0      0      0      0
927c33e97efSMauro Carvalho Chehab    Node    0, zone    DMA32, type    Unmovable    103     54     77      1      1      1     11      8      7      1      9
928c33e97efSMauro Carvalho Chehab    Node    0, zone    DMA32, type  Reclaimable      0      0      2      1      0      0      0      0      1      0      0
929c33e97efSMauro Carvalho Chehab    Node    0, zone    DMA32, type      Movable    169    152    113     91     77     54     39     13      6      1    452
930c33e97efSMauro Carvalho Chehab    Node    0, zone    DMA32, type      Reserve      1      2      2      2      2      0      1      1      1      1      0
931c33e97efSMauro Carvalho Chehab    Node    0, zone    DMA32, type      Isolate      0      0      0      0      0      0      0      0      0      0      0
932c33e97efSMauro Carvalho Chehab
933c33e97efSMauro Carvalho Chehab    Number of blocks type     Unmovable  Reclaimable      Movable      Reserve      Isolate
934c33e97efSMauro Carvalho Chehab    Node 0, zone      DMA            2            0            5            1            0
935c33e97efSMauro Carvalho Chehab    Node 0, zone    DMA32           41            6          967            2            0
936c33e97efSMauro Carvalho Chehab
937c33e97efSMauro Carvalho ChehabFragmentation avoidance in the kernel works by grouping pages of different
938c33e97efSMauro Carvalho Chehabmigrate types into the same contiguous regions of memory called page blocks.
939059db434SRandy DunlapA page block is typically the size of the default hugepage size, e.g. 2MB on
940c33e97efSMauro Carvalho ChehabX86-64. By keeping pages grouped based on their ability to move, the kernel
941c33e97efSMauro Carvalho Chehabcan reclaim pages within a page block to satisfy a high-order allocation.
942c33e97efSMauro Carvalho Chehab
943c33e97efSMauro Carvalho ChehabThe pagetypinfo begins with information on the size of a page block. It
944c33e97efSMauro Carvalho Chehabthen gives the same type of information as buddyinfo except broken down
945c33e97efSMauro Carvalho Chehabby migrate-type and finishes with details on how many page blocks of each
946c33e97efSMauro Carvalho Chehabtype exist.
947c33e97efSMauro Carvalho Chehab
948c33e97efSMauro Carvalho ChehabIf min_free_kbytes has been tuned correctly (recommendations made by hugeadm
949c33e97efSMauro Carvalho Chehabfrom libhugetlbfs https://github.com/libhugetlbfs/libhugetlbfs/), one can
950c33e97efSMauro Carvalho Chehabmake an estimate of the likely number of huge pages that can be allocated
951c33e97efSMauro Carvalho Chehabat a given point in time. All the "Movable" blocks should be allocatable
952c33e97efSMauro Carvalho Chehabunless memory has been mlock()'d. Some of the Reclaimable blocks should
953c33e97efSMauro Carvalho Chehabalso be allocatable although a lot of filesystem metadata may have to be
954c33e97efSMauro Carvalho Chehabreclaimed to achieve this.
955c33e97efSMauro Carvalho Chehab
956c33e97efSMauro Carvalho Chehab
957*22d407b1SSuren Baghdasaryanallocinfo
958*22d407b1SSuren Baghdasaryan~~~~~~~~~
959*22d407b1SSuren Baghdasaryan
960*22d407b1SSuren BaghdasaryanProvides information about memory allocations at all locations in the code
961*22d407b1SSuren Baghdasaryanbase. Each allocation in the code is identified by its source file, line
962*22d407b1SSuren Baghdasaryannumber, module (if originates from a loadable module) and the function calling
963*22d407b1SSuren Baghdasaryanthe allocation. The number of bytes allocated and number of calls at each
964*22d407b1SSuren Baghdasaryanlocation are reported.
965*22d407b1SSuren Baghdasaryan
966*22d407b1SSuren BaghdasaryanExample output.
967*22d407b1SSuren Baghdasaryan
968*22d407b1SSuren Baghdasaryan::
969*22d407b1SSuren Baghdasaryan
970*22d407b1SSuren Baghdasaryan    > sort -rn /proc/allocinfo
971*22d407b1SSuren Baghdasaryan   127664128    31168 mm/page_ext.c:270 func:alloc_page_ext
972*22d407b1SSuren Baghdasaryan    56373248     4737 mm/slub.c:2259 func:alloc_slab_page
973*22d407b1SSuren Baghdasaryan    14880768     3633 mm/readahead.c:247 func:page_cache_ra_unbounded
974*22d407b1SSuren Baghdasaryan    14417920     3520 mm/mm_init.c:2530 func:alloc_large_system_hash
975*22d407b1SSuren Baghdasaryan    13377536      234 block/blk-mq.c:3421 func:blk_mq_alloc_rqs
976*22d407b1SSuren Baghdasaryan    11718656     2861 mm/filemap.c:1919 func:__filemap_get_folio
977*22d407b1SSuren Baghdasaryan     9192960     2800 kernel/fork.c:307 func:alloc_thread_stack_node
978*22d407b1SSuren Baghdasaryan     4206592        4 net/netfilter/nf_conntrack_core.c:2567 func:nf_ct_alloc_hashtable
979*22d407b1SSuren Baghdasaryan     4136960     1010 drivers/staging/ctagmod/ctagmod.c:20 [ctagmod] func:ctagmod_start
980*22d407b1SSuren Baghdasaryan     3940352      962 mm/memory.c:4214 func:alloc_anon_folio
981*22d407b1SSuren Baghdasaryan     2894464    22613 fs/kernfs/dir.c:615 func:__kernfs_new_node
982*22d407b1SSuren Baghdasaryan     ...
983*22d407b1SSuren Baghdasaryan
984*22d407b1SSuren Baghdasaryan
985c33e97efSMauro Carvalho Chehabmeminfo
986c33e97efSMauro Carvalho Chehab~~~~~~~
987c33e97efSMauro Carvalho Chehab
988c33e97efSMauro Carvalho ChehabProvides information about distribution and utilization of memory.  This
9898d719afcSMike Rapoportvaries by architecture and compile options.  Some of the counters reported
9908d719afcSMike Rapoporthere overlap.  The memory reported by the non overlapping counters may not
9918d719afcSMike Rapoportadd up to the overall memory usage and the difference for some workloads
9928d719afcSMike Rapoportcan be substantial.  In many cases there are other means to find out
9938d719afcSMike Rapoportadditional memory using subsystem specific interfaces, for instance
9948d719afcSMike Rapoport/proc/net/sockstat for TCP memory allocations.
9958d719afcSMike Rapoport
99639799b64SJohannes WeinerExample output. You may not have all of these fields.
997c33e97efSMauro Carvalho Chehab
998c33e97efSMauro Carvalho Chehab::
999c33e97efSMauro Carvalho Chehab
1000c33e97efSMauro Carvalho Chehab    > cat /proc/meminfo
1001c33e97efSMauro Carvalho Chehab
100239799b64SJohannes Weiner    MemTotal:       32858820 kB
100339799b64SJohannes Weiner    MemFree:        21001236 kB
100439799b64SJohannes Weiner    MemAvailable:   27214312 kB
100539799b64SJohannes Weiner    Buffers:          581092 kB
100639799b64SJohannes Weiner    Cached:          5587612 kB
1007c33e97efSMauro Carvalho Chehab    SwapCached:            0 kB
100839799b64SJohannes Weiner    Active:          3237152 kB
100939799b64SJohannes Weiner    Inactive:        7586256 kB
101039799b64SJohannes Weiner    Active(anon):      94064 kB
101139799b64SJohannes Weiner    Inactive(anon):  4570616 kB
101239799b64SJohannes Weiner    Active(file):    3143088 kB
101339799b64SJohannes Weiner    Inactive(file):  3015640 kB
101439799b64SJohannes Weiner    Unevictable:           0 kB
101539799b64SJohannes Weiner    Mlocked:               0 kB
1016c33e97efSMauro Carvalho Chehab    SwapTotal:             0 kB
1017c33e97efSMauro Carvalho Chehab    SwapFree:              0 kB
1018f6498b77SJohannes Weiner    Zswap:              1904 kB
1019f6498b77SJohannes Weiner    Zswapped:           7792 kB
102039799b64SJohannes Weiner    Dirty:                12 kB
1021c33e97efSMauro Carvalho Chehab    Writeback:             0 kB
102239799b64SJohannes Weiner    AnonPages:       4654780 kB
102339799b64SJohannes Weiner    Mapped:           266244 kB
102439799b64SJohannes Weiner    Shmem:              9976 kB
102539799b64SJohannes Weiner    KReclaimable:     517708 kB
102639799b64SJohannes Weiner    Slab:             660044 kB
102739799b64SJohannes Weiner    SReclaimable:     517708 kB
102839799b64SJohannes Weiner    SUnreclaim:       142336 kB
102939799b64SJohannes Weiner    KernelStack:       11168 kB
103039799b64SJohannes Weiner    PageTables:        20540 kB
1031ebc97a52SYosry Ahmed    SecPageTables:         0 kB
1032c33e97efSMauro Carvalho Chehab    NFS_Unstable:          0 kB
1033c33e97efSMauro Carvalho Chehab    Bounce:                0 kB
1034c33e97efSMauro Carvalho Chehab    WritebackTmp:          0 kB
103539799b64SJohannes Weiner    CommitLimit:    16429408 kB
103639799b64SJohannes Weiner    Committed_AS:    7715148 kB
103739799b64SJohannes Weiner    VmallocTotal:   34359738367 kB
103839799b64SJohannes Weiner    VmallocUsed:       40444 kB
103939799b64SJohannes Weiner    VmallocChunk:          0 kB
104039799b64SJohannes Weiner    Percpu:            29312 kB
1041bd23024bSTomas Mudrunka    EarlyMemtestBad:       0 kB
1042c33e97efSMauro Carvalho Chehab    HardwareCorrupted:     0 kB
104339799b64SJohannes Weiner    AnonHugePages:   4149248 kB
1044c33e97efSMauro Carvalho Chehab    ShmemHugePages:        0 kB
1045c33e97efSMauro Carvalho Chehab    ShmemPmdMapped:        0 kB
104639799b64SJohannes Weiner    FileHugePages:         0 kB
104739799b64SJohannes Weiner    FilePmdMapped:         0 kB
104839799b64SJohannes Weiner    CmaTotal:              0 kB
104939799b64SJohannes Weiner    CmaFree:               0 kB
105039799b64SJohannes Weiner    HugePages_Total:       0
105139799b64SJohannes Weiner    HugePages_Free:        0
105239799b64SJohannes Weiner    HugePages_Rsvd:        0
105339799b64SJohannes Weiner    HugePages_Surp:        0
105439799b64SJohannes Weiner    Hugepagesize:       2048 kB
105539799b64SJohannes Weiner    Hugetlb:               0 kB
105639799b64SJohannes Weiner    DirectMap4k:      401152 kB
105739799b64SJohannes Weiner    DirectMap2M:    10008576 kB
105839799b64SJohannes Weiner    DirectMap1G:    24117248 kB
1059c33e97efSMauro Carvalho Chehab
1060c33e97efSMauro Carvalho ChehabMemTotal
1061059db434SRandy Dunlap              Total usable RAM (i.e. physical RAM minus a few reserved
1062c33e97efSMauro Carvalho Chehab              bits and the kernel binary code)
1063c33e97efSMauro Carvalho ChehabMemFree
106439799b64SJohannes Weiner              Total free RAM. On highmem systems, the sum of LowFree+HighFree
1065c33e97efSMauro Carvalho ChehabMemAvailable
1066c33e97efSMauro Carvalho Chehab              An estimate of how much memory is available for starting new
1067c33e97efSMauro Carvalho Chehab              applications, without swapping. Calculated from MemFree,
1068c33e97efSMauro Carvalho Chehab              SReclaimable, the size of the file LRU lists, and the low
1069c33e97efSMauro Carvalho Chehab              watermarks in each zone.
1070c33e97efSMauro Carvalho Chehab              The estimate takes into account that the system needs some
1071c33e97efSMauro Carvalho Chehab              page cache to function well, and that not all reclaimable
1072c33e97efSMauro Carvalho Chehab              slab will be reclaimable, due to items being in use. The
1073c33e97efSMauro Carvalho Chehab              impact of those factors will vary from system to system.
1074c33e97efSMauro Carvalho ChehabBuffers
1075c33e97efSMauro Carvalho Chehab              Relatively temporary storage for raw disk blocks
1076c33e97efSMauro Carvalho Chehab              shouldn't get tremendously large (20MB or so)
1077c33e97efSMauro Carvalho ChehabCached
107839799b64SJohannes Weiner              In-memory cache for files read from the disk (the
107939799b64SJohannes Weiner              pagecache) as well as tmpfs & shmem.
108039799b64SJohannes Weiner              Doesn't include SwapCached.
1081c33e97efSMauro Carvalho ChehabSwapCached
1082c33e97efSMauro Carvalho Chehab              Memory that once was swapped out, is swapped back in but
1083c33e97efSMauro Carvalho Chehab              still also is in the swapfile (if memory is needed it
1084c33e97efSMauro Carvalho Chehab              doesn't need to be swapped out AGAIN because it is already
1085c33e97efSMauro Carvalho Chehab              in the swapfile. This saves I/O)
1086c33e97efSMauro Carvalho ChehabActive
1087c33e97efSMauro Carvalho Chehab              Memory that has been used more recently and usually not
1088c33e97efSMauro Carvalho Chehab              reclaimed unless absolutely necessary.
1089c33e97efSMauro Carvalho ChehabInactive
1090c33e97efSMauro Carvalho Chehab              Memory which has been less recently used.  It is more
1091c33e97efSMauro Carvalho Chehab              eligible to be reclaimed for other purposes
109239799b64SJohannes WeinerUnevictable
109339799b64SJohannes Weiner              Memory allocated for userspace which cannot be reclaimed, such
109439799b64SJohannes Weiner              as mlocked pages, ramfs backing pages, secret memfd pages etc.
109539799b64SJohannes WeinerMlocked
109639799b64SJohannes Weiner              Memory locked with mlock().
1097c33e97efSMauro Carvalho ChehabHighTotal, HighFree
1098059db434SRandy Dunlap              Highmem is all memory above ~860MB of physical memory.
1099c33e97efSMauro Carvalho Chehab              Highmem areas are for use by userspace programs, or
1100c33e97efSMauro Carvalho Chehab              for the pagecache.  The kernel must use tricks to access
1101c33e97efSMauro Carvalho Chehab              this memory, making it slower to access than lowmem.
1102c33e97efSMauro Carvalho ChehabLowTotal, LowFree
1103c33e97efSMauro Carvalho Chehab              Lowmem is memory which can be used for everything that
1104c33e97efSMauro Carvalho Chehab              highmem can be used for, but it is also available for the
1105c33e97efSMauro Carvalho Chehab              kernel's use for its own data structures.  Among many
1106c33e97efSMauro Carvalho Chehab              other things, it is where everything from the Slab is
1107c33e97efSMauro Carvalho Chehab              allocated.  Bad things happen when you're out of lowmem.
1108c33e97efSMauro Carvalho ChehabSwapTotal
1109c33e97efSMauro Carvalho Chehab              total amount of swap space available
1110c33e97efSMauro Carvalho ChehabSwapFree
1111c33e97efSMauro Carvalho Chehab              Memory which has been evicted from RAM, and is temporarily
1112c33e97efSMauro Carvalho Chehab              on the disk
1113f6498b77SJohannes WeinerZswap
1114f6498b77SJohannes Weiner              Memory consumed by the zswap backend (compressed size)
1115f6498b77SJohannes WeinerZswapped
1116f6498b77SJohannes Weiner              Amount of anonymous memory stored in zswap (original size)
1117c33e97efSMauro Carvalho ChehabDirty
1118c33e97efSMauro Carvalho Chehab              Memory which is waiting to get written back to the disk
1119c33e97efSMauro Carvalho ChehabWriteback
1120c33e97efSMauro Carvalho Chehab              Memory which is actively being written back to the disk
1121c33e97efSMauro Carvalho ChehabAnonPages
1122c33e97efSMauro Carvalho Chehab              Non-file backed pages mapped into userspace page tables
1123c33e97efSMauro Carvalho ChehabMapped
1124d56b699dSBjorn Helgaas              files which have been mmapped, such as libraries
1125c33e97efSMauro Carvalho ChehabShmem
1126c33e97efSMauro Carvalho Chehab              Total memory used by shared memory (shmem) and tmpfs
1127c33e97efSMauro Carvalho ChehabKReclaimable
1128c33e97efSMauro Carvalho Chehab              Kernel allocations that the kernel will attempt to reclaim
1129c33e97efSMauro Carvalho Chehab              under memory pressure. Includes SReclaimable (below), and other
1130c33e97efSMauro Carvalho Chehab              direct allocations with a shrinker.
1131c33e97efSMauro Carvalho ChehabSlab
1132c33e97efSMauro Carvalho Chehab              in-kernel data structures cache
1133c33e97efSMauro Carvalho ChehabSReclaimable
1134c33e97efSMauro Carvalho Chehab              Part of Slab, that might be reclaimed, such as caches
1135c33e97efSMauro Carvalho ChehabSUnreclaim
1136c33e97efSMauro Carvalho Chehab              Part of Slab, that cannot be reclaimed on memory pressure
113739799b64SJohannes WeinerKernelStack
113839799b64SJohannes Weiner              Memory consumed by the kernel stacks of all tasks
1139c33e97efSMauro Carvalho ChehabPageTables
114039799b64SJohannes Weiner              Memory consumed by userspace page tables
1141ebc97a52SYosry AhmedSecPageTables
1142212c5c07SPasha Tatashin              Memory consumed by secondary page tables, this currently includes
1143212c5c07SPasha Tatashin              KVM mmu and IOMMU allocations on x86 and arm64.
1144c33e97efSMauro Carvalho ChehabNFS_Unstable
11458d92890bSNeilBrown              Always zero. Previous counted pages which had been written to
11468d92890bSNeilBrown              the server, but has not been committed to stable storage.
1147c33e97efSMauro Carvalho ChehabBounce
1148c33e97efSMauro Carvalho Chehab              Memory used for block device "bounce buffers"
1149c33e97efSMauro Carvalho ChehabWritebackTmp
1150c33e97efSMauro Carvalho Chehab              Memory used by FUSE for temporary writeback buffers
1151c33e97efSMauro Carvalho ChehabCommitLimit
1152c33e97efSMauro Carvalho Chehab              Based on the overcommit ratio ('vm.overcommit_ratio'),
1153c33e97efSMauro Carvalho Chehab              this is the total amount of  memory currently available to
1154c33e97efSMauro Carvalho Chehab              be allocated on the system. This limit is only adhered to
1155c33e97efSMauro Carvalho Chehab              if strict overcommit accounting is enabled (mode 2 in
1156c33e97efSMauro Carvalho Chehab              'vm.overcommit_memory').
1157c33e97efSMauro Carvalho Chehab
1158c33e97efSMauro Carvalho Chehab              The CommitLimit is calculated with the following formula::
1159c33e97efSMauro Carvalho Chehab
1160c33e97efSMauro Carvalho Chehab                CommitLimit = ([total RAM pages] - [total huge TLB pages]) *
1161c33e97efSMauro Carvalho Chehab                               overcommit_ratio / 100 + [total swap pages]
1162c33e97efSMauro Carvalho Chehab
1163c33e97efSMauro Carvalho Chehab              For example, on a system with 1G of physical RAM and 7G
1164c33e97efSMauro Carvalho Chehab              of swap with a `vm.overcommit_ratio` of 30 it would
1165c33e97efSMauro Carvalho Chehab              yield a CommitLimit of 7.3G.
1166c33e97efSMauro Carvalho Chehab
1167c33e97efSMauro Carvalho Chehab              For more details, see the memory overcommit documentation
1168ee65728eSMike Rapoport              in mm/overcommit-accounting.
1169c33e97efSMauro Carvalho ChehabCommitted_AS
1170c33e97efSMauro Carvalho Chehab              The amount of memory presently allocated on the system.
1171c33e97efSMauro Carvalho Chehab              The committed memory is a sum of all of the memory which
1172c33e97efSMauro Carvalho Chehab              has been allocated by processes, even if it has not been
1173c33e97efSMauro Carvalho Chehab              "used" by them as of yet. A process which malloc()'s 1G
1174c33e97efSMauro Carvalho Chehab              of memory, but only touches 300M of it will show up as
1175c33e97efSMauro Carvalho Chehab              using 1G. This 1G is memory which has been "committed" to
1176c33e97efSMauro Carvalho Chehab              by the VM and can be used at any time by the allocating
1177c33e97efSMauro Carvalho Chehab              application. With strict overcommit enabled on the system
1178c33e97efSMauro Carvalho Chehab              (mode 2 in 'vm.overcommit_memory'), allocations which would
1179c33e97efSMauro Carvalho Chehab              exceed the CommitLimit (detailed above) will not be permitted.
1180c33e97efSMauro Carvalho Chehab              This is useful if one needs to guarantee that processes will
1181c33e97efSMauro Carvalho Chehab              not fail due to lack of memory once that memory has been
1182c33e97efSMauro Carvalho Chehab              successfully allocated.
1183c33e97efSMauro Carvalho ChehabVmallocTotal
118439799b64SJohannes Weiner              total size of vmalloc virtual address space
1185c33e97efSMauro Carvalho ChehabVmallocUsed
1186c33e97efSMauro Carvalho Chehab              amount of vmalloc area which is used
1187c33e97efSMauro Carvalho ChehabVmallocChunk
1188c33e97efSMauro Carvalho Chehab              largest contiguous block of vmalloc area which is free
1189c33e97efSMauro Carvalho ChehabPercpu
1190c33e97efSMauro Carvalho Chehab              Memory allocated to the percpu allocator used to back percpu
1191c33e97efSMauro Carvalho Chehab              allocations. This stat excludes the cost of metadata.
1192bd23024bSTomas MudrunkaEarlyMemtestBad
1193bd23024bSTomas Mudrunka              The amount of RAM/memory in kB, that was identified as corrupted
1194bd23024bSTomas Mudrunka              by early memtest. If memtest was not run, this field will not
1195bd23024bSTomas Mudrunka              be displayed at all. Size is never rounded down to 0 kB.
1196bd23024bSTomas Mudrunka              That means if 0 kB is reported, you can safely assume
1197bd23024bSTomas Mudrunka              there was at least one pass of memtest and none of the passes
1198bd23024bSTomas Mudrunka              found a single faulty byte of RAM.
119939799b64SJohannes WeinerHardwareCorrupted
120039799b64SJohannes Weiner              The amount of RAM/memory in KB, the kernel identifies as
120139799b64SJohannes Weiner              corrupted.
120239799b64SJohannes WeinerAnonHugePages
120339799b64SJohannes Weiner              Non-file backed huge pages mapped into userspace page tables
120439799b64SJohannes WeinerShmemHugePages
120539799b64SJohannes Weiner              Memory used by shared memory (shmem) and tmpfs allocated
120639799b64SJohannes Weiner              with huge pages
120739799b64SJohannes WeinerShmemPmdMapped
120839799b64SJohannes Weiner              Shared memory mapped into userspace with huge pages
120939799b64SJohannes WeinerFileHugePages
121039799b64SJohannes Weiner              Memory used for filesystem data (page cache) allocated
121139799b64SJohannes Weiner              with huge pages
121239799b64SJohannes WeinerFilePmdMapped
121339799b64SJohannes Weiner              Page cache mapped into userspace with huge pages
121439799b64SJohannes WeinerCmaTotal
121539799b64SJohannes Weiner              Memory reserved for the Contiguous Memory Allocator (CMA)
121639799b64SJohannes WeinerCmaFree
121739799b64SJohannes Weiner              Free remaining memory in the CMA reserves
121839799b64SJohannes WeinerHugePages_Total, HugePages_Free, HugePages_Rsvd, HugePages_Surp, Hugepagesize, Hugetlb
121939799b64SJohannes Weiner              See Documentation/admin-guide/mm/hugetlbpage.rst.
122039799b64SJohannes WeinerDirectMap4k, DirectMap2M, DirectMap1G
122139799b64SJohannes Weiner              Breakdown of page table sizes used in the kernel's
122239799b64SJohannes Weiner              identity mapping of RAM
1223c33e97efSMauro Carvalho Chehab
1224c33e97efSMauro Carvalho Chehabvmallocinfo
1225c33e97efSMauro Carvalho Chehab~~~~~~~~~~~
1226c33e97efSMauro Carvalho Chehab
1227c33e97efSMauro Carvalho ChehabProvides information about vmalloced/vmaped areas. One line per area,
1228c33e97efSMauro Carvalho Chehabcontaining the virtual address range of the area, size in bytes,
1229c33e97efSMauro Carvalho Chehabcaller information of the creator, and optional information depending
1230c33e97efSMauro Carvalho Chehabon the kind of area:
1231c33e97efSMauro Carvalho Chehab
1232c33e97efSMauro Carvalho Chehab ==========  ===================================================
1233c33e97efSMauro Carvalho Chehab pages=nr    number of pages
1234c33e97efSMauro Carvalho Chehab phys=addr   if a physical address was specified
1235c33e97efSMauro Carvalho Chehab ioremap     I/O mapping (ioremap() and friends)
1236c33e97efSMauro Carvalho Chehab vmalloc     vmalloc() area
1237c33e97efSMauro Carvalho Chehab vmap        vmap()ed pages
1238c33e97efSMauro Carvalho Chehab user        VM_USERMAP area
1239c33e97efSMauro Carvalho Chehab vpages      buffer for pages pointers was vmalloced (huge area)
1240c33e97efSMauro Carvalho Chehab N<node>=nr  (Only on NUMA kernels)
1241c33e97efSMauro Carvalho Chehab             Number of pages allocated on memory node <node>
1242c33e97efSMauro Carvalho Chehab ==========  ===================================================
1243c33e97efSMauro Carvalho Chehab
1244c33e97efSMauro Carvalho Chehab::
1245c33e97efSMauro Carvalho Chehab
1246c33e97efSMauro Carvalho Chehab    > cat /proc/vmallocinfo
1247c33e97efSMauro Carvalho Chehab    0xffffc20000000000-0xffffc20000201000 2101248 alloc_large_system_hash+0x204 ...
1248c33e97efSMauro Carvalho Chehab    /0x2c0 pages=512 vmalloc N0=128 N1=128 N2=128 N3=128
1249c33e97efSMauro Carvalho Chehab    0xffffc20000201000-0xffffc20000302000 1052672 alloc_large_system_hash+0x204 ...
1250c33e97efSMauro Carvalho Chehab    /0x2c0 pages=256 vmalloc N0=64 N1=64 N2=64 N3=64
1251c33e97efSMauro Carvalho Chehab    0xffffc20000302000-0xffffc20000304000    8192 acpi_tb_verify_table+0x21/0x4f...
1252c33e97efSMauro Carvalho Chehab    phys=7fee8000 ioremap
1253c33e97efSMauro Carvalho Chehab    0xffffc20000304000-0xffffc20000307000   12288 acpi_tb_verify_table+0x21/0x4f...
1254c33e97efSMauro Carvalho Chehab    phys=7fee7000 ioremap
1255c33e97efSMauro Carvalho Chehab    0xffffc2000031d000-0xffffc2000031f000    8192 init_vdso_vars+0x112/0x210
1256c33e97efSMauro Carvalho Chehab    0xffffc2000031f000-0xffffc2000032b000   49152 cramfs_uncompress_init+0x2e ...
1257c33e97efSMauro Carvalho Chehab    /0x80 pages=11 vmalloc N0=3 N1=3 N2=2 N3=3
1258c33e97efSMauro Carvalho Chehab    0xffffc2000033a000-0xffffc2000033d000   12288 sys_swapon+0x640/0xac0      ...
1259c33e97efSMauro Carvalho Chehab    pages=2 vmalloc N1=2
1260c33e97efSMauro Carvalho Chehab    0xffffc20000347000-0xffffc2000034c000   20480 xt_alloc_table_info+0xfe ...
1261c33e97efSMauro Carvalho Chehab    /0x130 [x_tables] pages=4 vmalloc N0=4
1262c33e97efSMauro Carvalho Chehab    0xffffffffa0000000-0xffffffffa000f000   61440 sys_init_module+0xc27/0x1d00 ...
1263c33e97efSMauro Carvalho Chehab    pages=14 vmalloc N2=14
1264c33e97efSMauro Carvalho Chehab    0xffffffffa000f000-0xffffffffa0014000   20480 sys_init_module+0xc27/0x1d00 ...
1265c33e97efSMauro Carvalho Chehab    pages=4 vmalloc N1=4
1266c33e97efSMauro Carvalho Chehab    0xffffffffa0014000-0xffffffffa0017000   12288 sys_init_module+0xc27/0x1d00 ...
1267c33e97efSMauro Carvalho Chehab    pages=2 vmalloc N1=2
1268c33e97efSMauro Carvalho Chehab    0xffffffffa0017000-0xffffffffa0022000   45056 sys_init_module+0xc27/0x1d00 ...
1269c33e97efSMauro Carvalho Chehab    pages=10 vmalloc N0=10
1270c33e97efSMauro Carvalho Chehab
1271c33e97efSMauro Carvalho Chehab
1272c33e97efSMauro Carvalho Chehabsoftirqs
1273c33e97efSMauro Carvalho Chehab~~~~~~~~
1274c33e97efSMauro Carvalho Chehab
1275059db434SRandy DunlapProvides counts of softirq handlers serviced since boot time, for each CPU.
1276c33e97efSMauro Carvalho Chehab
1277c33e97efSMauro Carvalho Chehab::
1278c33e97efSMauro Carvalho Chehab
1279c33e97efSMauro Carvalho Chehab    > cat /proc/softirqs
1280c33e97efSMauro Carvalho Chehab		  CPU0       CPU1       CPU2       CPU3
1281c33e97efSMauro Carvalho Chehab	HI:          0          0          0          0
1282c33e97efSMauro Carvalho Chehab    TIMER:       27166      27120      27097      27034
1283c33e97efSMauro Carvalho Chehab    NET_TX:          0          0          0         17
1284c33e97efSMauro Carvalho Chehab    NET_RX:         42          0          0         39
1285c33e97efSMauro Carvalho Chehab    BLOCK:           0          0        107       1121
1286c33e97efSMauro Carvalho Chehab    TASKLET:         0          0          0        290
1287c33e97efSMauro Carvalho Chehab    SCHED:       27035      26983      26971      26746
1288c33e97efSMauro Carvalho Chehab    HRTIMER:         0          0          0          0
1289c33e97efSMauro Carvalho Chehab	RCU:      1678       1769       2178       2250
1290c33e97efSMauro Carvalho Chehab
1291e24ccaafSPaul Gortmaker1.3 Networking info in /proc/net
1292c33e97efSMauro Carvalho Chehab--------------------------------
1293c33e97efSMauro Carvalho Chehab
1294c33e97efSMauro Carvalho ChehabThe subdirectory  /proc/net  follows  the  usual  pattern. Table 1-8 shows the
1295c33e97efSMauro Carvalho Chehabadditional values  you  get  for  IP  version 6 if you configure the kernel to
1296c33e97efSMauro Carvalho Chehabsupport this. Table 1-9 lists the files and their meaning.
1297c33e97efSMauro Carvalho Chehab
1298c33e97efSMauro Carvalho Chehab
1299c33e97efSMauro Carvalho Chehab.. table:: Table 1-8: IPv6 info in /proc/net
1300c33e97efSMauro Carvalho Chehab
1301c33e97efSMauro Carvalho Chehab ========== =====================================================
1302c33e97efSMauro Carvalho Chehab File       Content
1303c33e97efSMauro Carvalho Chehab ========== =====================================================
1304c33e97efSMauro Carvalho Chehab udp6       UDP sockets (IPv6)
1305c33e97efSMauro Carvalho Chehab tcp6       TCP sockets (IPv6)
1306c33e97efSMauro Carvalho Chehab raw6       Raw device statistics (IPv6)
1307c33e97efSMauro Carvalho Chehab igmp6      IP multicast addresses, which this host joined (IPv6)
1308c33e97efSMauro Carvalho Chehab if_inet6   List of IPv6 interface addresses
1309c33e97efSMauro Carvalho Chehab ipv6_route Kernel routing table for IPv6
1310c33e97efSMauro Carvalho Chehab rt6_stats  Global IPv6 routing tables statistics
1311c33e97efSMauro Carvalho Chehab sockstat6  Socket statistics (IPv6)
1312c33e97efSMauro Carvalho Chehab snmp6      Snmp data (IPv6)
1313c33e97efSMauro Carvalho Chehab ========== =====================================================
1314c33e97efSMauro Carvalho Chehab
1315c33e97efSMauro Carvalho Chehab.. table:: Table 1-9: Network info in /proc/net
1316c33e97efSMauro Carvalho Chehab
1317c33e97efSMauro Carvalho Chehab ============= ================================================================
1318c33e97efSMauro Carvalho Chehab File          Content
1319c33e97efSMauro Carvalho Chehab ============= ================================================================
1320c33e97efSMauro Carvalho Chehab arp           Kernel  ARP table
1321c33e97efSMauro Carvalho Chehab dev           network devices with statistics
1322c33e97efSMauro Carvalho Chehab dev_mcast     the Layer2 multicast groups a device is listening too
1323c33e97efSMauro Carvalho Chehab               (interface index, label, number of references, number of bound
1324c33e97efSMauro Carvalho Chehab               addresses).
1325c33e97efSMauro Carvalho Chehab dev_stat      network device status
1326c33e97efSMauro Carvalho Chehab ip_fwchains   Firewall chain linkage
1327c33e97efSMauro Carvalho Chehab ip_fwnames    Firewall chain names
1328c33e97efSMauro Carvalho Chehab ip_masq       Directory containing the masquerading tables
1329c33e97efSMauro Carvalho Chehab ip_masquerade Major masquerading table
1330c33e97efSMauro Carvalho Chehab netstat       Network statistics
1331c33e97efSMauro Carvalho Chehab raw           raw device statistics
1332c33e97efSMauro Carvalho Chehab route         Kernel routing table
1333c33e97efSMauro Carvalho Chehab rpc           Directory containing rpc info
1334c33e97efSMauro Carvalho Chehab rt_cache      Routing cache
1335c33e97efSMauro Carvalho Chehab snmp          SNMP data
1336c33e97efSMauro Carvalho Chehab sockstat      Socket statistics
13378b0a211dSYang Yang softnet_stat  Per-CPU incoming packets queues statistics of online CPUs
1338c33e97efSMauro Carvalho Chehab tcp           TCP  sockets
1339c33e97efSMauro Carvalho Chehab udp           UDP sockets
1340c33e97efSMauro Carvalho Chehab unix          UNIX domain sockets
1341c33e97efSMauro Carvalho Chehab wireless      Wireless interface data (Wavelan etc)
1342c33e97efSMauro Carvalho Chehab igmp          IP multicast addresses, which this host joined
1343c33e97efSMauro Carvalho Chehab psched        Global packet scheduler parameters.
1344c33e97efSMauro Carvalho Chehab netlink       List of PF_NETLINK sockets
1345c33e97efSMauro Carvalho Chehab ip_mr_vifs    List of multicast virtual interfaces
1346c33e97efSMauro Carvalho Chehab ip_mr_cache   List of multicast routing cache
1347c33e97efSMauro Carvalho Chehab ============= ================================================================
1348c33e97efSMauro Carvalho Chehab
1349c33e97efSMauro Carvalho ChehabYou can  use  this  information  to see which network devices are available in
1350c33e97efSMauro Carvalho Chehabyour system and how much traffic was routed over those devices::
1351c33e97efSMauro Carvalho Chehab
1352c33e97efSMauro Carvalho Chehab  > cat /proc/net/dev
1353c33e97efSMauro Carvalho Chehab  Inter-|Receive                                                   |[...
1354c33e97efSMauro Carvalho Chehab   face |bytes    packets errs drop fifo frame compressed multicast|[...
1355c33e97efSMauro Carvalho Chehab      lo:  908188   5596     0    0    0     0          0         0 [...
1356c33e97efSMauro Carvalho Chehab    ppp0:15475140  20721   410    0    0   410          0         0 [...
1357c33e97efSMauro Carvalho Chehab    eth0:  614530   7085     0    0    0     0          0         1 [...
1358c33e97efSMauro Carvalho Chehab
1359c33e97efSMauro Carvalho Chehab  ...] Transmit
1360c33e97efSMauro Carvalho Chehab  ...] bytes    packets errs drop fifo colls carrier compressed
1361c33e97efSMauro Carvalho Chehab  ...]  908188     5596    0    0    0     0       0          0
1362c33e97efSMauro Carvalho Chehab  ...] 1375103    17405    0    0    0     0       0          0
1363c33e97efSMauro Carvalho Chehab  ...] 1703981     5535    0    0    0     3       0          0
1364c33e97efSMauro Carvalho Chehab
1365c33e97efSMauro Carvalho ChehabIn addition, each Channel Bond interface has its own directory.  For
1366c33e97efSMauro Carvalho Chehabexample, the bond0 device will have a directory called /proc/net/bond0/.
1367c33e97efSMauro Carvalho ChehabIt will contain information that is specific to that bond, such as the
1368c33e97efSMauro Carvalho Chehabcurrent slaves of the bond, the link status of the slaves, and how
1369c33e97efSMauro Carvalho Chehabmany times the slaves link has failed.
1370c33e97efSMauro Carvalho Chehab
1371e24ccaafSPaul Gortmaker1.4 SCSI info
1372c33e97efSMauro Carvalho Chehab-------------
1373c33e97efSMauro Carvalho Chehab
1374d2ea66a6SRandy DunlapIf you have a SCSI or ATA host adapter in your system, you'll find a
1375d2ea66a6SRandy Dunlapsubdirectory named after the driver for this adapter in /proc/scsi.
1376d2ea66a6SRandy DunlapYou'll also see a list of all recognized SCSI devices in /proc/scsi::
1377c33e97efSMauro Carvalho Chehab
1378c33e97efSMauro Carvalho Chehab  >cat /proc/scsi/scsi
1379c33e97efSMauro Carvalho Chehab  Attached devices:
1380c33e97efSMauro Carvalho Chehab  Host: scsi0 Channel: 00 Id: 00 Lun: 00
1381c33e97efSMauro Carvalho Chehab    Vendor: IBM      Model: DGHS09U          Rev: 03E0
1382c33e97efSMauro Carvalho Chehab    Type:   Direct-Access                    ANSI SCSI revision: 03
1383c33e97efSMauro Carvalho Chehab  Host: scsi0 Channel: 00 Id: 06 Lun: 00
1384c33e97efSMauro Carvalho Chehab    Vendor: PIONEER  Model: CD-ROM DR-U06S   Rev: 1.04
1385c33e97efSMauro Carvalho Chehab    Type:   CD-ROM                           ANSI SCSI revision: 02
1386c33e97efSMauro Carvalho Chehab
1387c33e97efSMauro Carvalho Chehab
1388c33e97efSMauro Carvalho ChehabThe directory  named  after  the driver has one file for each adapter found in
1389c33e97efSMauro Carvalho Chehabthe system.  These  files  contain information about the controller, including
1390c33e97efSMauro Carvalho Chehabthe used  IRQ  and  the  IO  address range. The amount of information shown is
1391c33e97efSMauro Carvalho Chehabdependent on  the adapter you use. The example shows the output for an Adaptec
1392c33e97efSMauro Carvalho ChehabAHA-2940 SCSI adapter::
1393c33e97efSMauro Carvalho Chehab
1394c33e97efSMauro Carvalho Chehab  > cat /proc/scsi/aic7xxx/0
1395c33e97efSMauro Carvalho Chehab
1396c33e97efSMauro Carvalho Chehab  Adaptec AIC7xxx driver version: 5.1.19/3.2.4
1397c33e97efSMauro Carvalho Chehab  Compile Options:
1398c33e97efSMauro Carvalho Chehab    TCQ Enabled By Default : Disabled
1399c33e97efSMauro Carvalho Chehab    AIC7XXX_PROC_STATS     : Disabled
1400c33e97efSMauro Carvalho Chehab    AIC7XXX_RESET_DELAY    : 5
1401c33e97efSMauro Carvalho Chehab  Adapter Configuration:
1402c33e97efSMauro Carvalho Chehab             SCSI Adapter: Adaptec AHA-294X Ultra SCSI host adapter
1403c33e97efSMauro Carvalho Chehab                             Ultra Wide Controller
1404c33e97efSMauro Carvalho Chehab      PCI MMAPed I/O Base: 0xeb001000
1405c33e97efSMauro Carvalho Chehab   Adapter SEEPROM Config: SEEPROM found and used.
1406c33e97efSMauro Carvalho Chehab        Adaptec SCSI BIOS: Enabled
1407c33e97efSMauro Carvalho Chehab                      IRQ: 10
1408c33e97efSMauro Carvalho Chehab                     SCBs: Active 0, Max Active 2,
1409c33e97efSMauro Carvalho Chehab                           Allocated 15, HW 16, Page 255
1410c33e97efSMauro Carvalho Chehab               Interrupts: 160328
1411c33e97efSMauro Carvalho Chehab        BIOS Control Word: 0x18b6
1412c33e97efSMauro Carvalho Chehab     Adapter Control Word: 0x005b
1413c33e97efSMauro Carvalho Chehab     Extended Translation: Enabled
1414c33e97efSMauro Carvalho Chehab  Disconnect Enable Flags: 0xffff
1415c33e97efSMauro Carvalho Chehab       Ultra Enable Flags: 0x0001
1416c33e97efSMauro Carvalho Chehab   Tag Queue Enable Flags: 0x0000
1417c33e97efSMauro Carvalho Chehab  Ordered Queue Tag Flags: 0x0000
1418c33e97efSMauro Carvalho Chehab  Default Tag Queue Depth: 8
1419c33e97efSMauro Carvalho Chehab      Tagged Queue By Device array for aic7xxx host instance 0:
1420c33e97efSMauro Carvalho Chehab        {255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}
1421c33e97efSMauro Carvalho Chehab      Actual queue depth per device for aic7xxx host instance 0:
1422c33e97efSMauro Carvalho Chehab        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
1423c33e97efSMauro Carvalho Chehab  Statistics:
1424c33e97efSMauro Carvalho Chehab  (scsi0:0:0:0)
1425c33e97efSMauro Carvalho Chehab    Device using Wide/Sync transfers at 40.0 MByte/sec, offset 8
1426c33e97efSMauro Carvalho Chehab    Transinfo settings: current(12/8/1/0), goal(12/8/1/0), user(12/15/1/0)
1427c33e97efSMauro Carvalho Chehab    Total transfers 160151 (74577 reads and 85574 writes)
1428c33e97efSMauro Carvalho Chehab  (scsi0:0:6:0)
1429c33e97efSMauro Carvalho Chehab    Device using Narrow/Sync transfers at 5.0 MByte/sec, offset 15
1430c33e97efSMauro Carvalho Chehab    Transinfo settings: current(50/15/0/0), goal(50/15/0/0), user(50/15/0/0)
1431c33e97efSMauro Carvalho Chehab    Total transfers 0 (0 reads and 0 writes)
1432c33e97efSMauro Carvalho Chehab
1433c33e97efSMauro Carvalho Chehab
1434e24ccaafSPaul Gortmaker1.5 Parallel port info in /proc/parport
1435c33e97efSMauro Carvalho Chehab---------------------------------------
1436c33e97efSMauro Carvalho Chehab
1437c33e97efSMauro Carvalho ChehabThe directory  /proc/parport  contains information about the parallel ports of
1438c33e97efSMauro Carvalho Chehabyour system.  It  has  one  subdirectory  for  each port, named after the port
1439c33e97efSMauro Carvalho Chehabnumber (0,1,2,...).
1440c33e97efSMauro Carvalho Chehab
1441c33e97efSMauro Carvalho ChehabThese directories contain the four files shown in Table 1-10.
1442c33e97efSMauro Carvalho Chehab
1443c33e97efSMauro Carvalho Chehab
1444c33e97efSMauro Carvalho Chehab.. table:: Table 1-10: Files in /proc/parport
1445c33e97efSMauro Carvalho Chehab
1446c33e97efSMauro Carvalho Chehab ========= ====================================================================
1447c33e97efSMauro Carvalho Chehab File      Content
1448c33e97efSMauro Carvalho Chehab ========= ====================================================================
1449c33e97efSMauro Carvalho Chehab autoprobe Any IEEE-1284 device ID information that has been acquired.
1450c33e97efSMauro Carvalho Chehab devices   list of the device drivers using that port. A + will appear by the
1451c33e97efSMauro Carvalho Chehab           name of the device currently using the port (it might not appear
1452c33e97efSMauro Carvalho Chehab           against any).
1453c33e97efSMauro Carvalho Chehab hardware  Parallel port's base address, IRQ line and DMA channel.
1454c33e97efSMauro Carvalho Chehab irq       IRQ that parport is using for that port. This is in a separate
1455c33e97efSMauro Carvalho Chehab           file to allow you to alter it by writing a new value in (IRQ
1456c33e97efSMauro Carvalho Chehab           number or none).
1457c33e97efSMauro Carvalho Chehab ========= ====================================================================
1458c33e97efSMauro Carvalho Chehab
1459e24ccaafSPaul Gortmaker1.6 TTY info in /proc/tty
1460c33e97efSMauro Carvalho Chehab-------------------------
1461c33e97efSMauro Carvalho Chehab
1462c33e97efSMauro Carvalho ChehabInformation about  the  available  and actually used tty's can be found in the
1463c33e97efSMauro Carvalho Chehabdirectory /proc/tty. You'll find  entries  for drivers and line disciplines in
1464c33e97efSMauro Carvalho Chehabthis directory, as shown in Table 1-11.
1465c33e97efSMauro Carvalho Chehab
1466c33e97efSMauro Carvalho Chehab
1467c33e97efSMauro Carvalho Chehab.. table:: Table 1-11: Files in /proc/tty
1468c33e97efSMauro Carvalho Chehab
1469c33e97efSMauro Carvalho Chehab ============= ==============================================
1470c33e97efSMauro Carvalho Chehab File          Content
1471c33e97efSMauro Carvalho Chehab ============= ==============================================
1472c33e97efSMauro Carvalho Chehab drivers       list of drivers and their usage
1473c33e97efSMauro Carvalho Chehab ldiscs        registered line disciplines
1474c33e97efSMauro Carvalho Chehab driver/serial usage statistic and status of single tty lines
1475c33e97efSMauro Carvalho Chehab ============= ==============================================
1476c33e97efSMauro Carvalho Chehab
1477c33e97efSMauro Carvalho ChehabTo see  which  tty's  are  currently in use, you can simply look into the file
1478c33e97efSMauro Carvalho Chehab/proc/tty/drivers::
1479c33e97efSMauro Carvalho Chehab
1480c33e97efSMauro Carvalho Chehab  > cat /proc/tty/drivers
1481c33e97efSMauro Carvalho Chehab  pty_slave            /dev/pts      136   0-255 pty:slave
1482c33e97efSMauro Carvalho Chehab  pty_master           /dev/ptm      128   0-255 pty:master
1483c33e97efSMauro Carvalho Chehab  pty_slave            /dev/ttyp       3   0-255 pty:slave
1484c33e97efSMauro Carvalho Chehab  pty_master           /dev/pty        2   0-255 pty:master
1485c33e97efSMauro Carvalho Chehab  serial               /dev/cua        5   64-67 serial:callout
1486c33e97efSMauro Carvalho Chehab  serial               /dev/ttyS       4   64-67 serial
1487c33e97efSMauro Carvalho Chehab  /dev/tty0            /dev/tty0       4       0 system:vtmaster
1488c33e97efSMauro Carvalho Chehab  /dev/ptmx            /dev/ptmx       5       2 system
1489c33e97efSMauro Carvalho Chehab  /dev/console         /dev/console    5       1 system:console
1490c33e97efSMauro Carvalho Chehab  /dev/tty             /dev/tty        5       0 system:/dev/tty
1491c33e97efSMauro Carvalho Chehab  unknown              /dev/tty        4    1-63 console
1492c33e97efSMauro Carvalho Chehab
1493c33e97efSMauro Carvalho Chehab
1494e24ccaafSPaul Gortmaker1.7 Miscellaneous kernel statistics in /proc/stat
1495c33e97efSMauro Carvalho Chehab-------------------------------------------------
1496c33e97efSMauro Carvalho Chehab
1497c33e97efSMauro Carvalho ChehabVarious pieces   of  information about  kernel activity  are  available in the
1498c33e97efSMauro Carvalho Chehab/proc/stat file.  All  of  the numbers reported  in  this file are  aggregates
1499c33e97efSMauro Carvalho Chehabsince the system first booted.  For a quick look, simply cat the file::
1500c33e97efSMauro Carvalho Chehab
1501c33e97efSMauro Carvalho Chehab  > cat /proc/stat
1502d2ea66a6SRandy Dunlap  cpu  237902850 368826709 106375398 1873517540 1135548 0 14507935 0 0 0
1503d2ea66a6SRandy Dunlap  cpu0 60045249 91891769 26331539 468411416 495718 0 5739640 0 0 0
1504d2ea66a6SRandy Dunlap  cpu1 59746288 91759249 26609887 468860630 312281 0 4384817 0 0 0
1505d2ea66a6SRandy Dunlap  cpu2 59489247 92985423 26904446 467808813 171668 0 2268998 0 0 0
1506d2ea66a6SRandy Dunlap  cpu3 58622065 92190267 26529524 468436680 155879 0 2114478 0 0 0
1507d2ea66a6SRandy Dunlap  intr 8688370575 8 3373 0 0 0 0 0 0 1 40791 0 0 353317 0 0 0 0 224789828 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 190974333 41958554 123983334 43 0 224593 0 0 0 <more 0's deleted>
1508d2ea66a6SRandy Dunlap  ctxt 22848221062
1509d2ea66a6SRandy Dunlap  btime 1605316999
1510d2ea66a6SRandy Dunlap  processes 746787147
1511d2ea66a6SRandy Dunlap  procs_running 2
1512c33e97efSMauro Carvalho Chehab  procs_blocked 0
1513d2ea66a6SRandy Dunlap  softirq 12121874454 100099120 3938138295 127375644 2795979 187870761 0 173808342 3072582055 52608 224184354
1514c33e97efSMauro Carvalho Chehab
1515c33e97efSMauro Carvalho ChehabThe very first  "cpu" line aggregates the  numbers in all  of the other "cpuN"
1516c33e97efSMauro Carvalho Chehablines.  These numbers identify the amount of time the CPU has spent performing
1517c33e97efSMauro Carvalho Chehabdifferent kinds of work.  Time units are in USER_HZ (typically hundredths of a
1518c33e97efSMauro Carvalho Chehabsecond).  The meanings of the columns are as follows, from left to right:
1519c33e97efSMauro Carvalho Chehab
1520c33e97efSMauro Carvalho Chehab- user: normal processes executing in user mode
1521c33e97efSMauro Carvalho Chehab- nice: niced processes executing in user mode
1522c33e97efSMauro Carvalho Chehab- system: processes executing in kernel mode
1523c33e97efSMauro Carvalho Chehab- idle: twiddling thumbs
1524c33e97efSMauro Carvalho Chehab- iowait: In a word, iowait stands for waiting for I/O to complete. But there
1525c33e97efSMauro Carvalho Chehab  are several problems:
1526c33e97efSMauro Carvalho Chehab
1527059db434SRandy Dunlap  1. CPU will not wait for I/O to complete, iowait is the time that a task is
1528059db434SRandy Dunlap     waiting for I/O to complete. When CPU goes into idle state for
1529059db434SRandy Dunlap     outstanding task I/O, another task will be scheduled on this CPU.
1530c33e97efSMauro Carvalho Chehab  2. In a multi-core CPU, the task waiting for I/O to complete is not running
1531c33e97efSMauro Carvalho Chehab     on any CPU, so the iowait of each CPU is difficult to calculate.
1532c33e97efSMauro Carvalho Chehab  3. The value of iowait field in /proc/stat will decrease in certain
1533c33e97efSMauro Carvalho Chehab     conditions.
1534c33e97efSMauro Carvalho Chehab
1535c33e97efSMauro Carvalho Chehab  So, the iowait is not reliable by reading from /proc/stat.
1536c33e97efSMauro Carvalho Chehab- irq: servicing interrupts
1537c33e97efSMauro Carvalho Chehab- softirq: servicing softirqs
1538c33e97efSMauro Carvalho Chehab- steal: involuntary wait
1539c33e97efSMauro Carvalho Chehab- guest: running a normal guest
1540c33e97efSMauro Carvalho Chehab- guest_nice: running a niced guest
1541c33e97efSMauro Carvalho Chehab
1542c33e97efSMauro Carvalho ChehabThe "intr" line gives counts of interrupts  serviced since boot time, for each
1543c33e97efSMauro Carvalho Chehabof the  possible system interrupts.   The first  column  is the  total of  all
1544c33e97efSMauro Carvalho Chehabinterrupts serviced  including  unnumbered  architecture specific  interrupts;
1545c33e97efSMauro Carvalho Chehabeach  subsequent column is the  total for that particular numbered interrupt.
1546c33e97efSMauro Carvalho ChehabUnnumbered interrupts are not shown, only summed into the total.
1547c33e97efSMauro Carvalho Chehab
1548c33e97efSMauro Carvalho ChehabThe "ctxt" line gives the total number of context switches across all CPUs.
1549c33e97efSMauro Carvalho Chehab
1550c33e97efSMauro Carvalho ChehabThe "btime" line gives  the time at which the  system booted, in seconds since
1551c33e97efSMauro Carvalho Chehabthe Unix epoch.
1552c33e97efSMauro Carvalho Chehab
1553c33e97efSMauro Carvalho ChehabThe "processes" line gives the number  of processes and threads created, which
1554c33e97efSMauro Carvalho Chehabincludes (but  is not limited  to) those  created by  calls to the  fork() and
1555c33e97efSMauro Carvalho Chehabclone() system calls.
1556c33e97efSMauro Carvalho Chehab
1557c33e97efSMauro Carvalho ChehabThe "procs_running" line gives the total number of threads that are
1558c33e97efSMauro Carvalho Chehabrunning or ready to run (i.e., the total number of runnable threads).
1559c33e97efSMauro Carvalho Chehab
1560c33e97efSMauro Carvalho ChehabThe   "procs_blocked" line gives  the  number of  processes currently blocked,
1561c33e97efSMauro Carvalho Chehabwaiting for I/O to complete.
1562c33e97efSMauro Carvalho Chehab
1563c33e97efSMauro Carvalho ChehabThe "softirq" line gives counts of softirqs serviced since boot time, for each
1564c33e97efSMauro Carvalho Chehabof the possible system softirqs. The first column is the total of all
1565c33e97efSMauro Carvalho Chehabsoftirqs serviced; each subsequent column is the total for that particular
1566c33e97efSMauro Carvalho Chehabsoftirq.
1567c33e97efSMauro Carvalho Chehab
1568c33e97efSMauro Carvalho Chehab
1569e24ccaafSPaul Gortmaker1.8 Ext4 file system parameters
1570c33e97efSMauro Carvalho Chehab-------------------------------
1571c33e97efSMauro Carvalho Chehab
1572c33e97efSMauro Carvalho ChehabInformation about mounted ext4 file systems can be found in
1573c33e97efSMauro Carvalho Chehab/proc/fs/ext4.  Each mounted filesystem will have a directory in
1574c33e97efSMauro Carvalho Chehab/proc/fs/ext4 based on its device name (i.e., /proc/fs/ext4/hdc or
1575d2ea66a6SRandy Dunlap/proc/fs/ext4/sda9 or /proc/fs/ext4/dm-0).   The files in each per-device
1576d2ea66a6SRandy Dunlapdirectory are shown in Table 1-12, below.
1577c33e97efSMauro Carvalho Chehab
1578c33e97efSMauro Carvalho Chehab.. table:: Table 1-12: Files in /proc/fs/ext4/<devname>
1579c33e97efSMauro Carvalho Chehab
1580c33e97efSMauro Carvalho Chehab ==============  ==========================================================
1581c33e97efSMauro Carvalho Chehab File            Content
1582c33e97efSMauro Carvalho Chehab mb_groups       details of multiblock allocator buddy cache of free blocks
1583c33e97efSMauro Carvalho Chehab ==============  ==========================================================
1584c33e97efSMauro Carvalho Chehab
1585e24ccaafSPaul Gortmaker1.9 /proc/consoles
1586059db434SRandy Dunlap-------------------
1587c33e97efSMauro Carvalho ChehabShows registered system console lines.
1588c33e97efSMauro Carvalho Chehab
1589c33e97efSMauro Carvalho ChehabTo see which character device lines are currently used for the system console
1590c33e97efSMauro Carvalho Chehab/dev/console, you may simply look into the file /proc/consoles::
1591c33e97efSMauro Carvalho Chehab
1592c33e97efSMauro Carvalho Chehab  > cat /proc/consoles
1593c33e97efSMauro Carvalho Chehab  tty0                 -WU (ECp)       4:7
1594c33e97efSMauro Carvalho Chehab  ttyS0                -W- (Ep)        4:64
1595c33e97efSMauro Carvalho Chehab
1596c33e97efSMauro Carvalho ChehabThe columns are:
1597c33e97efSMauro Carvalho Chehab
1598c33e97efSMauro Carvalho Chehab+--------------------+-------------------------------------------------------+
1599c33e97efSMauro Carvalho Chehab| device             | name of the device                                    |
1600c33e97efSMauro Carvalho Chehab+====================+=======================================================+
1601c33e97efSMauro Carvalho Chehab| operations         | * R = can do read operations                          |
1602c33e97efSMauro Carvalho Chehab|                    | * W = can do write operations                         |
1603c33e97efSMauro Carvalho Chehab|                    | * U = can do unblank                                  |
1604c33e97efSMauro Carvalho Chehab+--------------------+-------------------------------------------------------+
1605c33e97efSMauro Carvalho Chehab| flags              | * E = it is enabled                                   |
1606c33e97efSMauro Carvalho Chehab|                    | * C = it is preferred console                         |
1607c33e97efSMauro Carvalho Chehab|                    | * B = it is primary boot console                      |
1608c33e97efSMauro Carvalho Chehab|                    | * p = it is used for printk buffer                    |
1609c33e97efSMauro Carvalho Chehab|                    | * b = it is not a TTY but a Braille device            |
1610c33e97efSMauro Carvalho Chehab|                    | * a = it is safe to use when cpu is offline           |
1611c33e97efSMauro Carvalho Chehab+--------------------+-------------------------------------------------------+
1612c33e97efSMauro Carvalho Chehab| major:minor        | major and minor number of the device separated by a   |
1613c33e97efSMauro Carvalho Chehab|                    | colon                                                 |
1614c33e97efSMauro Carvalho Chehab+--------------------+-------------------------------------------------------+
1615c33e97efSMauro Carvalho Chehab
1616c33e97efSMauro Carvalho ChehabSummary
1617c33e97efSMauro Carvalho Chehab-------
1618c33e97efSMauro Carvalho Chehab
1619c33e97efSMauro Carvalho ChehabThe /proc file system serves information about the running system. It not only
1620c33e97efSMauro Carvalho Chehaballows access to process data but also allows you to request the kernel status
1621c33e97efSMauro Carvalho Chehabby reading files in the hierarchy.
1622c33e97efSMauro Carvalho Chehab
1623c33e97efSMauro Carvalho ChehabThe directory  structure  of /proc reflects the types of information and makes
1624c33e97efSMauro Carvalho Chehabit easy, if not obvious, where to look for specific data.
1625c33e97efSMauro Carvalho Chehab
1626c33e97efSMauro Carvalho ChehabChapter 2: Modifying System Parameters
1627c33e97efSMauro Carvalho Chehab======================================
1628c33e97efSMauro Carvalho Chehab
1629c33e97efSMauro Carvalho ChehabIn This Chapter
1630c33e97efSMauro Carvalho Chehab---------------
1631c33e97efSMauro Carvalho Chehab
1632c33e97efSMauro Carvalho Chehab* Modifying kernel parameters by writing into files found in /proc/sys
1633c33e97efSMauro Carvalho Chehab* Exploring the files which modify certain parameters
1634c33e97efSMauro Carvalho Chehab* Review of the /proc/sys file tree
1635c33e97efSMauro Carvalho Chehab
1636c33e97efSMauro Carvalho Chehab------------------------------------------------------------------------------
1637c33e97efSMauro Carvalho Chehab
1638c33e97efSMauro Carvalho ChehabA very  interesting part of /proc is the directory /proc/sys. This is not only
1639c33e97efSMauro Carvalho Chehaba source  of  information,  it also allows you to change parameters within the
1640c33e97efSMauro Carvalho Chehabkernel. Be  very  careful  when attempting this. You can optimize your system,
1641c33e97efSMauro Carvalho Chehabbut you  can  also  cause  it  to  crash.  Never  alter kernel parameters on a
1642c33e97efSMauro Carvalho Chehabproduction system.  Set  up  a  development machine and test to make sure that
1643c33e97efSMauro Carvalho Chehabeverything works  the  way  you want it to. You may have no alternative but to
1644c33e97efSMauro Carvalho Chehabreboot the machine once an error has been made.
1645c33e97efSMauro Carvalho Chehab
1646059db434SRandy DunlapTo change  a  value,  simply  echo  the new value into the file.
1647059db434SRandy DunlapYou need to be root to do this. You  can  create  your  own  boot script
1648059db434SRandy Dunlapto perform this every time your system boots.
1649c33e97efSMauro Carvalho Chehab
1650c33e97efSMauro Carvalho ChehabThe files  in /proc/sys can be used to fine tune and monitor miscellaneous and
1651c33e97efSMauro Carvalho Chehabgeneral things  in  the operation of the Linux kernel. Since some of the files
1652c33e97efSMauro Carvalho Chehabcan inadvertently  disrupt  your  system,  it  is  advisable  to  read  both
1653c33e97efSMauro Carvalho Chehabdocumentation and  source  before actually making adjustments. In any case, be
1654c33e97efSMauro Carvalho Chehabvery careful  when  writing  to  any  of these files. The entries in /proc may
1655c33e97efSMauro Carvalho Chehabchange slightly between the 2.1.* and the 2.2 kernel, so if there is any doubt
1656d2ea66a6SRandy Dunlapreview the kernel documentation in the directory linux/Documentation.
1657c33e97efSMauro Carvalho ChehabThis chapter  is  heavily  based  on the documentation included in the pre 2.2
1658c33e97efSMauro Carvalho Chehabkernels, and became part of it in version 2.2.1 of the Linux kernel.
1659c33e97efSMauro Carvalho Chehab
1660d2ea66a6SRandy DunlapPlease see: Documentation/admin-guide/sysctl/ directory for descriptions of
1661d2ea66a6SRandy Dunlapthese entries.
1662c33e97efSMauro Carvalho Chehab
1663c33e97efSMauro Carvalho ChehabSummary
1664c33e97efSMauro Carvalho Chehab-------
1665c33e97efSMauro Carvalho Chehab
1666c33e97efSMauro Carvalho ChehabCertain aspects  of  kernel  behavior  can be modified at runtime, without the
1667c33e97efSMauro Carvalho Chehabneed to  recompile  the kernel, or even to reboot the system. The files in the
1668c33e97efSMauro Carvalho Chehab/proc/sys tree  can  not only be read, but also modified. You can use the echo
1669c33e97efSMauro Carvalho Chehabcommand to write value into these files, thereby changing the default settings
1670c33e97efSMauro Carvalho Chehabof the kernel.
1671c33e97efSMauro Carvalho Chehab
1672c33e97efSMauro Carvalho Chehab
1673c33e97efSMauro Carvalho ChehabChapter 3: Per-process Parameters
1674c33e97efSMauro Carvalho Chehab=================================
1675c33e97efSMauro Carvalho Chehab
1676c33e97efSMauro Carvalho Chehab3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj- Adjust the oom-killer score
1677c33e97efSMauro Carvalho Chehab--------------------------------------------------------------------------------
1678c33e97efSMauro Carvalho Chehab
1679059db434SRandy DunlapThese files can be used to adjust the badness heuristic used to select which
1680059db434SRandy Dunlapprocess gets killed in out of memory (oom) conditions.
1681c33e97efSMauro Carvalho Chehab
1682c33e97efSMauro Carvalho ChehabThe badness heuristic assigns a value to each candidate task ranging from 0
1683c33e97efSMauro Carvalho Chehab(never kill) to 1000 (always kill) to determine which process is targeted.  The
1684c33e97efSMauro Carvalho Chehabunits are roughly a proportion along that range of allowed memory the process
1685c33e97efSMauro Carvalho Chehabmay allocate from based on an estimation of its current memory and swap use.
1686c33e97efSMauro Carvalho ChehabFor example, if a task is using all allowed memory, its badness score will be
1687c33e97efSMauro Carvalho Chehab1000.  If it is using half of its allowed memory, its score will be 500.
1688c33e97efSMauro Carvalho Chehab
1689c33e97efSMauro Carvalho ChehabThe amount of "allowed" memory depends on the context in which the oom killer
1690c33e97efSMauro Carvalho Chehabwas called.  If it is due to the memory assigned to the allocating task's cpuset
1691c33e97efSMauro Carvalho Chehabbeing exhausted, the allowed memory represents the set of mems assigned to that
1692c33e97efSMauro Carvalho Chehabcpuset.  If it is due to a mempolicy's node(s) being exhausted, the allowed
1693c33e97efSMauro Carvalho Chehabmemory represents the set of mempolicy nodes.  If it is due to a memory
1694c33e97efSMauro Carvalho Chehablimit (or swap limit) being reached, the allowed memory is that configured
1695c33e97efSMauro Carvalho Chehablimit.  Finally, if it is due to the entire system being out of memory, the
1696c33e97efSMauro Carvalho Chehaballowed memory represents all allocatable resources.
1697c33e97efSMauro Carvalho Chehab
1698c33e97efSMauro Carvalho ChehabThe value of /proc/<pid>/oom_score_adj is added to the badness score before it
1699c33e97efSMauro Carvalho Chehabis used to determine which task to kill.  Acceptable values range from -1000
1700c33e97efSMauro Carvalho Chehab(OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX).  This allows userspace to
1701c33e97efSMauro Carvalho Chehabpolarize the preference for oom killing either by always preferring a certain
1702c33e97efSMauro Carvalho Chehabtask or completely disabling it.  The lowest possible value, -1000, is
1703c33e97efSMauro Carvalho Chehabequivalent to disabling oom killing entirely for that task since it will always
1704c33e97efSMauro Carvalho Chehabreport a badness score of 0.
1705c33e97efSMauro Carvalho Chehab
1706c33e97efSMauro Carvalho ChehabConsequently, it is very simple for userspace to define the amount of memory to
1707c33e97efSMauro Carvalho Chehabconsider for each task.  Setting a /proc/<pid>/oom_score_adj value of +500, for
1708c33e97efSMauro Carvalho Chehabexample, is roughly equivalent to allowing the remainder of tasks sharing the
1709c33e97efSMauro Carvalho Chehabsame system, cpuset, mempolicy, or memory controller resources to use at least
1710c33e97efSMauro Carvalho Chehab50% more memory.  A value of -500, on the other hand, would be roughly
1711c33e97efSMauro Carvalho Chehabequivalent to discounting 50% of the task's allowed memory from being considered
1712c33e97efSMauro Carvalho Chehabas scoring against the task.
1713c33e97efSMauro Carvalho Chehab
1714c33e97efSMauro Carvalho ChehabFor backwards compatibility with previous kernels, /proc/<pid>/oom_adj may also
1715c33e97efSMauro Carvalho Chehabbe used to tune the badness score.  Its acceptable values range from -16
1716c33e97efSMauro Carvalho Chehab(OOM_ADJUST_MIN) to +15 (OOM_ADJUST_MAX) and a special value of -17
1717c33e97efSMauro Carvalho Chehab(OOM_DISABLE) to disable oom killing entirely for that task.  Its value is
1718c33e97efSMauro Carvalho Chehabscaled linearly with /proc/<pid>/oom_score_adj.
1719c33e97efSMauro Carvalho Chehab
1720c33e97efSMauro Carvalho ChehabThe value of /proc/<pid>/oom_score_adj may be reduced no lower than the last
1721c33e97efSMauro Carvalho Chehabvalue set by a CAP_SYS_RESOURCE process. To reduce the value any lower
1722c33e97efSMauro Carvalho Chehabrequires CAP_SYS_RESOURCE.
1723c33e97efSMauro Carvalho Chehab
1724c33e97efSMauro Carvalho Chehab
1725c33e97efSMauro Carvalho Chehab3.2 /proc/<pid>/oom_score - Display current oom-killer score
1726c33e97efSMauro Carvalho Chehab-------------------------------------------------------------
1727c33e97efSMauro Carvalho Chehab
1728059db434SRandy DunlapThis file can be used to check the current score used by the oom-killer for
1729c33e97efSMauro Carvalho Chehabany given <pid>. Use it together with /proc/<pid>/oom_score_adj to tune which
1730c33e97efSMauro Carvalho Chehabprocess should be killed in an out-of-memory situation.
1731c33e97efSMauro Carvalho Chehab
1732b1aa7c93SMichal HockoPlease note that the exported value includes oom_score_adj so it is
1733b1aa7c93SMichal Hockoeffectively in range [0,2000].
1734b1aa7c93SMichal Hocko
1735c33e97efSMauro Carvalho Chehab
1736c33e97efSMauro Carvalho Chehab3.3  /proc/<pid>/io - Display the IO accounting fields
1737c33e97efSMauro Carvalho Chehab-------------------------------------------------------
1738c33e97efSMauro Carvalho Chehab
1739059db434SRandy DunlapThis file contains IO statistics for each running process.
1740c33e97efSMauro Carvalho Chehab
1741c33e97efSMauro Carvalho ChehabExample
1742c33e97efSMauro Carvalho Chehab~~~~~~~
1743c33e97efSMauro Carvalho Chehab
1744c33e97efSMauro Carvalho Chehab::
1745c33e97efSMauro Carvalho Chehab
1746c33e97efSMauro Carvalho Chehab    test:/tmp # dd if=/dev/zero of=/tmp/test.dat &
1747c33e97efSMauro Carvalho Chehab    [1] 3828
1748c33e97efSMauro Carvalho Chehab
1749c33e97efSMauro Carvalho Chehab    test:/tmp # cat /proc/3828/io
1750c33e97efSMauro Carvalho Chehab    rchar: 323934931
1751c33e97efSMauro Carvalho Chehab    wchar: 323929600
1752c33e97efSMauro Carvalho Chehab    syscr: 632687
1753c33e97efSMauro Carvalho Chehab    syscw: 632675
1754c33e97efSMauro Carvalho Chehab    read_bytes: 0
1755c33e97efSMauro Carvalho Chehab    write_bytes: 323932160
1756c33e97efSMauro Carvalho Chehab    cancelled_write_bytes: 0
1757c33e97efSMauro Carvalho Chehab
1758c33e97efSMauro Carvalho Chehab
1759c33e97efSMauro Carvalho ChehabDescription
1760c33e97efSMauro Carvalho Chehab~~~~~~~~~~~
1761c33e97efSMauro Carvalho Chehab
1762c33e97efSMauro Carvalho Chehabrchar
1763c33e97efSMauro Carvalho Chehab^^^^^
1764c33e97efSMauro Carvalho Chehab
1765c33e97efSMauro Carvalho ChehabI/O counter: chars read
1766c33e97efSMauro Carvalho ChehabThe number of bytes which this task has caused to be read from storage. This
1767c33e97efSMauro Carvalho Chehabis simply the sum of bytes which this process passed to read() and pread().
1768c33e97efSMauro Carvalho ChehabIt includes things like tty IO and it is unaffected by whether or not actual
1769c33e97efSMauro Carvalho Chehabphysical disk IO was required (the read might have been satisfied from
1770059db434SRandy Dunlappagecache).
1771c33e97efSMauro Carvalho Chehab
1772c33e97efSMauro Carvalho Chehab
1773c33e97efSMauro Carvalho Chehabwchar
1774c33e97efSMauro Carvalho Chehab^^^^^
1775c33e97efSMauro Carvalho Chehab
1776c33e97efSMauro Carvalho ChehabI/O counter: chars written
1777c33e97efSMauro Carvalho ChehabThe number of bytes which this task has caused, or shall cause to be written
1778c33e97efSMauro Carvalho Chehabto disk. Similar caveats apply here as with rchar.
1779c33e97efSMauro Carvalho Chehab
1780c33e97efSMauro Carvalho Chehab
1781c33e97efSMauro Carvalho Chehabsyscr
1782c33e97efSMauro Carvalho Chehab^^^^^
1783c33e97efSMauro Carvalho Chehab
1784c33e97efSMauro Carvalho ChehabI/O counter: read syscalls
1785c33e97efSMauro Carvalho ChehabAttempt to count the number of read I/O operations, i.e. syscalls like read()
1786c33e97efSMauro Carvalho Chehaband pread().
1787c33e97efSMauro Carvalho Chehab
1788c33e97efSMauro Carvalho Chehab
1789c33e97efSMauro Carvalho Chehabsyscw
1790c33e97efSMauro Carvalho Chehab^^^^^
1791c33e97efSMauro Carvalho Chehab
1792c33e97efSMauro Carvalho ChehabI/O counter: write syscalls
1793c33e97efSMauro Carvalho ChehabAttempt to count the number of write I/O operations, i.e. syscalls like
1794c33e97efSMauro Carvalho Chehabwrite() and pwrite().
1795c33e97efSMauro Carvalho Chehab
1796c33e97efSMauro Carvalho Chehab
1797c33e97efSMauro Carvalho Chehabread_bytes
1798c33e97efSMauro Carvalho Chehab^^^^^^^^^^
1799c33e97efSMauro Carvalho Chehab
1800c33e97efSMauro Carvalho ChehabI/O counter: bytes read
1801c33e97efSMauro Carvalho ChehabAttempt to count the number of bytes which this process really did cause to
1802c33e97efSMauro Carvalho Chehabbe fetched from the storage layer. Done at the submit_bio() level, so it is
1803c33e97efSMauro Carvalho Chehabaccurate for block-backed filesystems. <please add status regarding NFS and
1804c33e97efSMauro Carvalho ChehabCIFS at a later time>
1805c33e97efSMauro Carvalho Chehab
1806c33e97efSMauro Carvalho Chehab
1807c33e97efSMauro Carvalho Chehabwrite_bytes
1808c33e97efSMauro Carvalho Chehab^^^^^^^^^^^
1809c33e97efSMauro Carvalho Chehab
1810c33e97efSMauro Carvalho ChehabI/O counter: bytes written
1811c33e97efSMauro Carvalho ChehabAttempt to count the number of bytes which this process caused to be sent to
1812c33e97efSMauro Carvalho Chehabthe storage layer. This is done at page-dirtying time.
1813c33e97efSMauro Carvalho Chehab
1814c33e97efSMauro Carvalho Chehab
1815c33e97efSMauro Carvalho Chehabcancelled_write_bytes
1816c33e97efSMauro Carvalho Chehab^^^^^^^^^^^^^^^^^^^^^
1817c33e97efSMauro Carvalho Chehab
1818c33e97efSMauro Carvalho ChehabThe big inaccuracy here is truncate. If a process writes 1MB to a file and
1819c33e97efSMauro Carvalho Chehabthen deletes the file, it will in fact perform no writeout. But it will have
1820c33e97efSMauro Carvalho Chehabbeen accounted as having caused 1MB of write.
1821c33e97efSMauro Carvalho ChehabIn other words: The number of bytes which this process caused to not happen,
1822c33e97efSMauro Carvalho Chehabby truncating pagecache. A task can cause "negative" IO too. If this task
1823c33e97efSMauro Carvalho Chehabtruncates some dirty pagecache, some IO which another task has been accounted
1824c33e97efSMauro Carvalho Chehabfor (in its write_bytes) will not be happening. We _could_ just subtract that
1825c33e97efSMauro Carvalho Chehabfrom the truncating task's write_bytes, but there is information loss in doing
1826c33e97efSMauro Carvalho Chehabthat.
1827c33e97efSMauro Carvalho Chehab
1828c33e97efSMauro Carvalho Chehab
1829c33e97efSMauro Carvalho Chehab.. Note::
1830c33e97efSMauro Carvalho Chehab
1831c33e97efSMauro Carvalho Chehab   At its current implementation state, this is a bit racy on 32-bit machines:
1832c33e97efSMauro Carvalho Chehab   if process A reads process B's /proc/pid/io while process B is updating one
1833c33e97efSMauro Carvalho Chehab   of those 64-bit counters, process A could see an intermediate result.
1834c33e97efSMauro Carvalho Chehab
1835c33e97efSMauro Carvalho Chehab
1836c33e97efSMauro Carvalho ChehabMore information about this can be found within the taskstats documentation in
1837c33e97efSMauro Carvalho ChehabDocumentation/accounting.
1838c33e97efSMauro Carvalho Chehab
1839c33e97efSMauro Carvalho Chehab3.4 /proc/<pid>/coredump_filter - Core dump filtering settings
1840c33e97efSMauro Carvalho Chehab---------------------------------------------------------------
1841c33e97efSMauro Carvalho ChehabWhen a process is dumped, all anonymous memory is written to a core file as
1842c33e97efSMauro Carvalho Chehablong as the size of the core file isn't limited. But sometimes we don't want
1843c33e97efSMauro Carvalho Chehabto dump some memory segments, for example, huge shared memory or DAX.
1844c33e97efSMauro Carvalho ChehabConversely, sometimes we want to save file-backed memory segments into a core
1845c33e97efSMauro Carvalho Chehabfile, not only the individual files.
1846c33e97efSMauro Carvalho Chehab
1847c33e97efSMauro Carvalho Chehab/proc/<pid>/coredump_filter allows you to customize which memory segments
1848c33e97efSMauro Carvalho Chehabwill be dumped when the <pid> process is dumped. coredump_filter is a bitmask
1849c33e97efSMauro Carvalho Chehabof memory types. If a bit of the bitmask is set, memory segments of the
1850c33e97efSMauro Carvalho Chehabcorresponding memory type are dumped, otherwise they are not dumped.
1851c33e97efSMauro Carvalho Chehab
1852c33e97efSMauro Carvalho ChehabThe following 9 memory types are supported:
1853c33e97efSMauro Carvalho Chehab
1854c33e97efSMauro Carvalho Chehab  - (bit 0) anonymous private memory
1855c33e97efSMauro Carvalho Chehab  - (bit 1) anonymous shared memory
1856c33e97efSMauro Carvalho Chehab  - (bit 2) file-backed private memory
1857c33e97efSMauro Carvalho Chehab  - (bit 3) file-backed shared memory
1858c33e97efSMauro Carvalho Chehab  - (bit 4) ELF header pages in file-backed private memory areas (it is
1859c33e97efSMauro Carvalho Chehab    effective only if the bit 2 is cleared)
1860c33e97efSMauro Carvalho Chehab  - (bit 5) hugetlb private memory
1861c33e97efSMauro Carvalho Chehab  - (bit 6) hugetlb shared memory
1862c33e97efSMauro Carvalho Chehab  - (bit 7) DAX private memory
1863c33e97efSMauro Carvalho Chehab  - (bit 8) DAX shared memory
1864c33e97efSMauro Carvalho Chehab
1865c33e97efSMauro Carvalho Chehab  Note that MMIO pages such as frame buffer are never dumped and vDSO pages
1866c33e97efSMauro Carvalho Chehab  are always dumped regardless of the bitmask status.
1867c33e97efSMauro Carvalho Chehab
1868c33e97efSMauro Carvalho Chehab  Note that bits 0-4 don't affect hugetlb or DAX memory. hugetlb memory is
1869c33e97efSMauro Carvalho Chehab  only affected by bit 5-6, and DAX is only affected by bits 7-8.
1870c33e97efSMauro Carvalho Chehab
1871c33e97efSMauro Carvalho ChehabThe default value of coredump_filter is 0x33; this means all anonymous memory
1872c33e97efSMauro Carvalho Chehabsegments, ELF header pages and hugetlb private memory are dumped.
1873c33e97efSMauro Carvalho Chehab
1874c33e97efSMauro Carvalho ChehabIf you don't want to dump all shared memory segments attached to pid 1234,
1875c33e97efSMauro Carvalho Chehabwrite 0x31 to the process's proc file::
1876c33e97efSMauro Carvalho Chehab
1877c33e97efSMauro Carvalho Chehab  $ echo 0x31 > /proc/1234/coredump_filter
1878c33e97efSMauro Carvalho Chehab
1879c33e97efSMauro Carvalho ChehabWhen a new process is created, the process inherits the bitmask status from its
1880c33e97efSMauro Carvalho Chehabparent. It is useful to set up coredump_filter before the program runs.
1881c33e97efSMauro Carvalho ChehabFor example::
1882c33e97efSMauro Carvalho Chehab
1883c33e97efSMauro Carvalho Chehab  $ echo 0x7 > /proc/self/coredump_filter
1884c33e97efSMauro Carvalho Chehab  $ ./some_program
1885c33e97efSMauro Carvalho Chehab
1886c33e97efSMauro Carvalho Chehab3.5	/proc/<pid>/mountinfo - Information about mounts
1887c33e97efSMauro Carvalho Chehab--------------------------------------------------------
1888c33e97efSMauro Carvalho Chehab
1889c33e97efSMauro Carvalho ChehabThis file contains lines of the form::
1890c33e97efSMauro Carvalho Chehab
1891c33e97efSMauro Carvalho Chehab    36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
1892ff9c3d43SChristoph Anton Mitterer    (1)(2)(3)   (4)   (5)      (6)     (n…m) (m+1)(m+2) (m+3)         (m+4)
1893c33e97efSMauro Carvalho Chehab
1894c33e97efSMauro Carvalho Chehab    (1)   mount ID:        unique identifier of the mount (may be reused after umount)
1895c33e97efSMauro Carvalho Chehab    (2)   parent ID:       ID of parent (or of self for the top of the mount tree)
1896c33e97efSMauro Carvalho Chehab    (3)   major:minor:     value of st_dev for files on filesystem
1897c33e97efSMauro Carvalho Chehab    (4)   root:            root of the mount within the filesystem
1898c33e97efSMauro Carvalho Chehab    (5)   mount point:     mount point relative to the process's root
1899c33e97efSMauro Carvalho Chehab    (6)   mount options:   per mount options
1900ff9c3d43SChristoph Anton Mitterer    (n…m) optional fields: zero or more fields of the form "tag[:value]"
1901ff9c3d43SChristoph Anton Mitterer    (m+1) separator:       marks the end of the optional fields
1902ff9c3d43SChristoph Anton Mitterer    (m+2) filesystem type: name of filesystem of the form "type[.subtype]"
1903ff9c3d43SChristoph Anton Mitterer    (m+3) mount source:    filesystem specific information or "none"
1904ff9c3d43SChristoph Anton Mitterer    (m+4) super options:   per super block options
1905c33e97efSMauro Carvalho Chehab
1906c33e97efSMauro Carvalho ChehabParsers should ignore all unrecognised optional fields.  Currently the
1907c33e97efSMauro Carvalho Chehabpossible optional fields are:
1908c33e97efSMauro Carvalho Chehab
1909c33e97efSMauro Carvalho Chehab================  ==============================================================
1910c33e97efSMauro Carvalho Chehabshared:X          mount is shared in peer group X
1911c33e97efSMauro Carvalho Chehabmaster:X          mount is slave to peer group X
1912c33e97efSMauro Carvalho Chehabpropagate_from:X  mount is slave and receives propagation from peer group X [#]_
1913c33e97efSMauro Carvalho Chehabunbindable        mount is unbindable
1914c33e97efSMauro Carvalho Chehab================  ==============================================================
1915c33e97efSMauro Carvalho Chehab
1916c33e97efSMauro Carvalho Chehab.. [#] X is the closest dominant peer group under the process's root.  If
1917c33e97efSMauro Carvalho Chehab       X is the immediate master of the mount, or if there's no dominant peer
1918c33e97efSMauro Carvalho Chehab       group under the same root, then only the "master:X" field is present
1919c33e97efSMauro Carvalho Chehab       and not the "propagate_from:X" field.
1920c33e97efSMauro Carvalho Chehab
1921c33e97efSMauro Carvalho ChehabFor more information on mount propagation see:
1922c33e97efSMauro Carvalho Chehab
1923cf06612cSMauro Carvalho Chehab  Documentation/filesystems/sharedsubtree.rst
1924c33e97efSMauro Carvalho Chehab
1925c33e97efSMauro Carvalho Chehab
1926c33e97efSMauro Carvalho Chehab3.6	/proc/<pid>/comm  & /proc/<pid>/task/<tid>/comm
1927c33e97efSMauro Carvalho Chehab--------------------------------------------------------
1928059db434SRandy DunlapThese files provide a method to access a task's comm value. It also allows for
1929c33e97efSMauro Carvalho Chehaba task to set its own or one of its thread siblings comm value. The comm value
1930c33e97efSMauro Carvalho Chehabis limited in size compared to the cmdline value, so writing anything longer
19312d1ab26aSChristoph Anton Mittererthen the kernel's TASK_COMM_LEN (currently 16 chars, including the NUL
19322d1ab26aSChristoph Anton Mittererterminator) will result in a truncated comm value.
1933c33e97efSMauro Carvalho Chehab
1934c33e97efSMauro Carvalho Chehab
1935c33e97efSMauro Carvalho Chehab3.7	/proc/<pid>/task/<tid>/children - Information about task children
1936c33e97efSMauro Carvalho Chehab-------------------------------------------------------------------------
1937c33e97efSMauro Carvalho ChehabThis file provides a fast way to retrieve first level children pids
1938c33e97efSMauro Carvalho Chehabof a task pointed by <pid>/<tid> pair. The format is a space separated
1939c33e97efSMauro Carvalho Chehabstream of pids.
1940c33e97efSMauro Carvalho Chehab
1941059db434SRandy DunlapNote the "first level" here -- if a child has its own children they will
1942059db434SRandy Dunlapnot be listed here; one needs to read /proc/<children-pid>/task/<tid>/children
1943c33e97efSMauro Carvalho Chehabto obtain the descendants.
1944c33e97efSMauro Carvalho Chehab
1945c33e97efSMauro Carvalho ChehabSince this interface is intended to be fast and cheap it doesn't
1946c33e97efSMauro Carvalho Chehabguarantee to provide precise results and some children might be
1947c33e97efSMauro Carvalho Chehabskipped, especially if they've exited right after we printed their
1948059db434SRandy Dunlappids, so one needs to either stop or freeze processes being inspected
1949c33e97efSMauro Carvalho Chehabif precise results are needed.
1950c33e97efSMauro Carvalho Chehab
1951c33e97efSMauro Carvalho Chehab
1952c33e97efSMauro Carvalho Chehab3.8	/proc/<pid>/fdinfo/<fd> - Information about opened file
1953c33e97efSMauro Carvalho Chehab---------------------------------------------------------------
1954c33e97efSMauro Carvalho ChehabThis file provides information associated with an opened file. The regular
19553845f256SKalesh Singhfiles have at least four fields -- 'pos', 'flags', 'mnt_id' and 'ino'.
19563845f256SKalesh SinghThe 'pos' represents the current offset of the opened file in decimal
19573845f256SKalesh Singhform [see lseek(2) for details], 'flags' denotes the octal O_xxx mask the
19583845f256SKalesh Singhfile has been created with [see open(2) for details] and 'mnt_id' represents
19593845f256SKalesh Singhmount ID of the file system containing the opened file [see 3.5
19603845f256SKalesh Singh/proc/<pid>/mountinfo for details]. 'ino' represents the inode number of
19613845f256SKalesh Singhthe file.
1962c33e97efSMauro Carvalho Chehab
1963c33e97efSMauro Carvalho ChehabA typical output is::
1964c33e97efSMauro Carvalho Chehab
1965c33e97efSMauro Carvalho Chehab	pos:	0
1966c33e97efSMauro Carvalho Chehab	flags:	0100002
1967c33e97efSMauro Carvalho Chehab	mnt_id:	19
19683845f256SKalesh Singh	ino:	63107
1969c33e97efSMauro Carvalho Chehab
1970c33e97efSMauro Carvalho ChehabAll locks associated with a file descriptor are shown in its fdinfo too::
1971c33e97efSMauro Carvalho Chehab
1972c33e97efSMauro Carvalho Chehab    lock:       1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
1973c33e97efSMauro Carvalho Chehab
1974c33e97efSMauro Carvalho ChehabThe files such as eventfd, fsnotify, signalfd, epoll among the regular pos/flags
1975c33e97efSMauro Carvalho Chehabpair provide additional information particular to the objects they represent.
1976c33e97efSMauro Carvalho Chehab
1977c33e97efSMauro Carvalho ChehabEventfd files
1978c33e97efSMauro Carvalho Chehab~~~~~~~~~~~~~
1979c33e97efSMauro Carvalho Chehab
1980c33e97efSMauro Carvalho Chehab::
1981c33e97efSMauro Carvalho Chehab
1982c33e97efSMauro Carvalho Chehab	pos:	0
1983c33e97efSMauro Carvalho Chehab	flags:	04002
1984c33e97efSMauro Carvalho Chehab	mnt_id:	9
19853845f256SKalesh Singh	ino:	63107
1986c33e97efSMauro Carvalho Chehab	eventfd-count:	5a
1987c33e97efSMauro Carvalho Chehab
1988c33e97efSMauro Carvalho Chehabwhere 'eventfd-count' is hex value of a counter.
1989c33e97efSMauro Carvalho Chehab
1990c33e97efSMauro Carvalho ChehabSignalfd files
1991c33e97efSMauro Carvalho Chehab~~~~~~~~~~~~~~
1992c33e97efSMauro Carvalho Chehab
1993c33e97efSMauro Carvalho Chehab::
1994c33e97efSMauro Carvalho Chehab
1995c33e97efSMauro Carvalho Chehab	pos:	0
1996c33e97efSMauro Carvalho Chehab	flags:	04002
1997c33e97efSMauro Carvalho Chehab	mnt_id:	9
19983845f256SKalesh Singh	ino:	63107
1999c33e97efSMauro Carvalho Chehab	sigmask:	0000000000000200
2000c33e97efSMauro Carvalho Chehab
2001c33e97efSMauro Carvalho Chehabwhere 'sigmask' is hex value of the signal mask associated
2002c33e97efSMauro Carvalho Chehabwith a file.
2003c33e97efSMauro Carvalho Chehab
2004c33e97efSMauro Carvalho ChehabEpoll files
2005c33e97efSMauro Carvalho Chehab~~~~~~~~~~~
2006c33e97efSMauro Carvalho Chehab
2007c33e97efSMauro Carvalho Chehab::
2008c33e97efSMauro Carvalho Chehab
2009c33e97efSMauro Carvalho Chehab	pos:	0
2010c33e97efSMauro Carvalho Chehab	flags:	02
2011c33e97efSMauro Carvalho Chehab	mnt_id:	9
20123845f256SKalesh Singh	ino:	63107
2013c33e97efSMauro Carvalho Chehab	tfd:        5 events:       1d data: ffffffffffffffff pos:0 ino:61af sdev:7
2014c33e97efSMauro Carvalho Chehab
2015c33e97efSMauro Carvalho Chehabwhere 'tfd' is a target file descriptor number in decimal form,
2016c33e97efSMauro Carvalho Chehab'events' is events mask being watched and the 'data' is data
2017c33e97efSMauro Carvalho Chehabassociated with a target [see epoll(7) for more details].
2018c33e97efSMauro Carvalho Chehab
2019c33e97efSMauro Carvalho ChehabThe 'pos' is current offset of the target file in decimal form
2020c33e97efSMauro Carvalho Chehab[see lseek(2)], 'ino' and 'sdev' are inode and device numbers
2021c33e97efSMauro Carvalho Chehabwhere target file resides, all in hex format.
2022c33e97efSMauro Carvalho Chehab
2023c33e97efSMauro Carvalho ChehabFsnotify files
2024c33e97efSMauro Carvalho Chehab~~~~~~~~~~~~~~
2025c33e97efSMauro Carvalho ChehabFor inotify files the format is the following::
2026c33e97efSMauro Carvalho Chehab
2027c33e97efSMauro Carvalho Chehab	pos:	0
2028c33e97efSMauro Carvalho Chehab	flags:	02000000
20293845f256SKalesh Singh	mnt_id:	9
20303845f256SKalesh Singh	ino:	63107
2031c33e97efSMauro Carvalho Chehab	inotify wd:3 ino:9e7e sdev:800013 mask:800afce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:7e9e0000640d1b6d
2032c33e97efSMauro Carvalho Chehab
2033059db434SRandy Dunlapwhere 'wd' is a watch descriptor in decimal form, i.e. a target file
2034c33e97efSMauro Carvalho Chehabdescriptor number, 'ino' and 'sdev' are inode and device where the
2035c33e97efSMauro Carvalho Chehabtarget file resides and the 'mask' is the mask of events, all in hex
2036c33e97efSMauro Carvalho Chehabform [see inotify(7) for more details].
2037c33e97efSMauro Carvalho Chehab
2038c33e97efSMauro Carvalho ChehabIf the kernel was built with exportfs support, the path to the target
2039c33e97efSMauro Carvalho Chehabfile is encoded as a file handle.  The file handle is provided by three
2040c33e97efSMauro Carvalho Chehabfields 'fhandle-bytes', 'fhandle-type' and 'f_handle', all in hex
2041c33e97efSMauro Carvalho Chehabformat.
2042c33e97efSMauro Carvalho Chehab
2043c33e97efSMauro Carvalho ChehabIf the kernel is built without exportfs support the file handle won't be
2044c33e97efSMauro Carvalho Chehabprinted out.
2045c33e97efSMauro Carvalho Chehab
2046c33e97efSMauro Carvalho ChehabIf there is no inotify mark attached yet the 'inotify' line will be omitted.
2047c33e97efSMauro Carvalho Chehab
2048c33e97efSMauro Carvalho ChehabFor fanotify files the format is::
2049c33e97efSMauro Carvalho Chehab
2050c33e97efSMauro Carvalho Chehab	pos:	0
2051c33e97efSMauro Carvalho Chehab	flags:	02
2052c33e97efSMauro Carvalho Chehab	mnt_id:	9
20533845f256SKalesh Singh	ino:	63107
2054c33e97efSMauro Carvalho Chehab	fanotify flags:10 event-flags:0
2055c33e97efSMauro Carvalho Chehab	fanotify mnt_id:12 mflags:40 mask:38 ignored_mask:40000003
2056c33e97efSMauro Carvalho Chehab	fanotify ino:4f969 sdev:800013 mflags:0 mask:3b ignored_mask:40000000 fhandle-bytes:8 fhandle-type:1 f_handle:69f90400c275b5b4
2057c33e97efSMauro Carvalho Chehab
2058c33e97efSMauro Carvalho Chehabwhere fanotify 'flags' and 'event-flags' are values used in fanotify_init
2059c33e97efSMauro Carvalho Chehabcall, 'mnt_id' is the mount point identifier, 'mflags' is the value of
2060c33e97efSMauro Carvalho Chehabflags associated with mark which are tracked separately from events
2061059db434SRandy Dunlapmask. 'ino' and 'sdev' are target inode and device, 'mask' is the events
2062c33e97efSMauro Carvalho Chehabmask and 'ignored_mask' is the mask of events which are to be ignored.
2063059db434SRandy DunlapAll are in hex format. Incorporation of 'mflags', 'mask' and 'ignored_mask'
2064059db434SRandy Dunlapprovide information about flags and mask used in fanotify_mark
2065c33e97efSMauro Carvalho Chehabcall [see fsnotify manpage for details].
2066c33e97efSMauro Carvalho Chehab
2067c33e97efSMauro Carvalho ChehabWhile the first three lines are mandatory and always printed, the rest is
2068c33e97efSMauro Carvalho Chehaboptional and may be omitted if no marks created yet.
2069c33e97efSMauro Carvalho Chehab
2070c33e97efSMauro Carvalho ChehabTimerfd files
2071c33e97efSMauro Carvalho Chehab~~~~~~~~~~~~~
2072c33e97efSMauro Carvalho Chehab
2073c33e97efSMauro Carvalho Chehab::
2074c33e97efSMauro Carvalho Chehab
2075c33e97efSMauro Carvalho Chehab	pos:	0
2076c33e97efSMauro Carvalho Chehab	flags:	02
2077c33e97efSMauro Carvalho Chehab	mnt_id:	9
20783845f256SKalesh Singh	ino:	63107
2079c33e97efSMauro Carvalho Chehab	clockid: 0
2080c33e97efSMauro Carvalho Chehab	ticks: 0
2081c33e97efSMauro Carvalho Chehab	settime flags: 01
2082c33e97efSMauro Carvalho Chehab	it_value: (0, 49406829)
2083c33e97efSMauro Carvalho Chehab	it_interval: (1, 0)
2084c33e97efSMauro Carvalho Chehab
2085c33e97efSMauro Carvalho Chehabwhere 'clockid' is the clock type and 'ticks' is the number of the timer expirations
2086c33e97efSMauro Carvalho Chehabthat have occurred [see timerfd_create(2) for details]. 'settime flags' are
2087c33e97efSMauro Carvalho Chehabflags in octal form been used to setup the timer [see timerfd_settime(2) for
2088059db434SRandy Dunlapdetails]. 'it_value' is remaining time until the timer expiration.
2089c33e97efSMauro Carvalho Chehab'it_interval' is the interval for the timer. Note the timer might be set up
2090c33e97efSMauro Carvalho Chehabwith TIMER_ABSTIME option which will be shown in 'settime flags', but 'it_value'
2091c33e97efSMauro Carvalho Chehabstill exhibits timer's remaining time.
2092c33e97efSMauro Carvalho Chehab
20933845f256SKalesh SinghDMA Buffer files
20943845f256SKalesh Singh~~~~~~~~~~~~~~~~
20953845f256SKalesh Singh
20963845f256SKalesh Singh::
20973845f256SKalesh Singh
20983845f256SKalesh Singh	pos:	0
20993845f256SKalesh Singh	flags:	04002
21003845f256SKalesh Singh	mnt_id:	9
21013845f256SKalesh Singh	ino:	63107
21023845f256SKalesh Singh	size:   32768
21033845f256SKalesh Singh	count:  2
21043845f256SKalesh Singh	exp_name:  system-heap
21053845f256SKalesh Singh
21063845f256SKalesh Singhwhere 'size' is the size of the DMA buffer in bytes. 'count' is the file count of
21073845f256SKalesh Singhthe DMA buffer file. 'exp_name' is the name of the DMA buffer exporter.
21083845f256SKalesh Singh
2109c33e97efSMauro Carvalho Chehab3.9	/proc/<pid>/map_files - Information about memory mapped files
2110c33e97efSMauro Carvalho Chehab---------------------------------------------------------------------
2111c33e97efSMauro Carvalho ChehabThis directory contains symbolic links which represent memory mapped files
2112c33e97efSMauro Carvalho Chehabthe process is maintaining.  Example output::
2113c33e97efSMauro Carvalho Chehab
2114c33e97efSMauro Carvalho Chehab     | lr-------- 1 root root 64 Jan 27 11:24 333c600000-333c620000 -> /usr/lib64/ld-2.18.so
2115c33e97efSMauro Carvalho Chehab     | lr-------- 1 root root 64 Jan 27 11:24 333c81f000-333c820000 -> /usr/lib64/ld-2.18.so
2116c33e97efSMauro Carvalho Chehab     | lr-------- 1 root root 64 Jan 27 11:24 333c820000-333c821000 -> /usr/lib64/ld-2.18.so
2117c33e97efSMauro Carvalho Chehab     | ...
2118c33e97efSMauro Carvalho Chehab     | lr-------- 1 root root 64 Jan 27 11:24 35d0421000-35d0422000 -> /usr/lib64/libselinux.so.1
2119c33e97efSMauro Carvalho Chehab     | lr-------- 1 root root 64 Jan 27 11:24 400000-41a000 -> /usr/bin/ls
2120c33e97efSMauro Carvalho Chehab
2121c33e97efSMauro Carvalho ChehabThe name of a link represents the virtual memory bounds of a mapping, i.e.
2122c33e97efSMauro Carvalho Chehabvm_area_struct::vm_start-vm_area_struct::vm_end.
2123c33e97efSMauro Carvalho Chehab
2124c33e97efSMauro Carvalho ChehabThe main purpose of the map_files is to retrieve a set of memory mapped
2125c33e97efSMauro Carvalho Chehabfiles in a fast way instead of parsing /proc/<pid>/maps or
2126c33e97efSMauro Carvalho Chehab/proc/<pid>/smaps, both of which contain many more records.  At the same
2127c33e97efSMauro Carvalho Chehabtime one can open(2) mappings from the listings of two processes and
2128c33e97efSMauro Carvalho Chehabcomparing their inode numbers to figure out which anonymous memory areas
2129c33e97efSMauro Carvalho Chehabare actually shared.
2130c33e97efSMauro Carvalho Chehab
2131c33e97efSMauro Carvalho Chehab3.10	/proc/<pid>/timerslack_ns - Task timerslack value
2132c33e97efSMauro Carvalho Chehab---------------------------------------------------------
2133c33e97efSMauro Carvalho ChehabThis file provides the value of the task's timerslack value in nanoseconds.
2134059db434SRandy DunlapThis value specifies an amount of time that normal timers may be deferred
2135c33e97efSMauro Carvalho Chehabin order to coalesce timers and avoid unnecessary wakeups.
2136c33e97efSMauro Carvalho Chehab
2137c33e97efSMauro Carvalho ChehabThis allows a task's interactivity vs power consumption tradeoff to be
2138c33e97efSMauro Carvalho Chehabadjusted.
2139c33e97efSMauro Carvalho Chehab
2140059db434SRandy DunlapWriting 0 to the file will set the task's timerslack to the default value.
2141c33e97efSMauro Carvalho Chehab
2142c33e97efSMauro Carvalho ChehabValid values are from 0 - ULLONG_MAX
2143c33e97efSMauro Carvalho Chehab
2144c33e97efSMauro Carvalho ChehabAn application setting the value must have PTRACE_MODE_ATTACH_FSCREDS level
2145c33e97efSMauro Carvalho Chehabpermissions on the task specified to change its timerslack_ns value.
2146c33e97efSMauro Carvalho Chehab
2147c33e97efSMauro Carvalho Chehab3.11	/proc/<pid>/patch_state - Livepatch patch operation state
2148c33e97efSMauro Carvalho Chehab-----------------------------------------------------------------
2149c33e97efSMauro Carvalho ChehabWhen CONFIG_LIVEPATCH is enabled, this file displays the value of the
2150c33e97efSMauro Carvalho Chehabpatch state for the task.
2151c33e97efSMauro Carvalho Chehab
2152c33e97efSMauro Carvalho ChehabA value of '-1' indicates that no patch is in transition.
2153c33e97efSMauro Carvalho Chehab
2154c33e97efSMauro Carvalho ChehabA value of '0' indicates that a patch is in transition and the task is
2155c33e97efSMauro Carvalho Chehabunpatched.  If the patch is being enabled, then the task hasn't been
2156c33e97efSMauro Carvalho Chehabpatched yet.  If the patch is being disabled, then the task has already
2157c33e97efSMauro Carvalho Chehabbeen unpatched.
2158c33e97efSMauro Carvalho Chehab
2159c33e97efSMauro Carvalho ChehabA value of '1' indicates that a patch is in transition and the task is
2160c33e97efSMauro Carvalho Chehabpatched.  If the patch is being enabled, then the task has already been
2161c33e97efSMauro Carvalho Chehabpatched.  If the patch is being disabled, then the task hasn't been
2162c33e97efSMauro Carvalho Chehabunpatched yet.
2163c33e97efSMauro Carvalho Chehab
2164c33e97efSMauro Carvalho Chehab3.12 /proc/<pid>/arch_status - task architecture specific status
2165c33e97efSMauro Carvalho Chehab-------------------------------------------------------------------
2166c33e97efSMauro Carvalho ChehabWhen CONFIG_PROC_PID_ARCH_STATUS is enabled, this file displays the
2167c33e97efSMauro Carvalho Chehabarchitecture specific status of the task.
2168c33e97efSMauro Carvalho Chehab
2169c33e97efSMauro Carvalho ChehabExample
2170c33e97efSMauro Carvalho Chehab~~~~~~~
2171c33e97efSMauro Carvalho Chehab
2172c33e97efSMauro Carvalho Chehab::
2173c33e97efSMauro Carvalho Chehab
2174c33e97efSMauro Carvalho Chehab $ cat /proc/6753/arch_status
2175c33e97efSMauro Carvalho Chehab AVX512_elapsed_ms:      8
2176c33e97efSMauro Carvalho Chehab
2177c33e97efSMauro Carvalho ChehabDescription
2178c33e97efSMauro Carvalho Chehab~~~~~~~~~~~
2179c33e97efSMauro Carvalho Chehab
2180059db434SRandy Dunlapx86 specific entries
2181c33e97efSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~
2182c33e97efSMauro Carvalho Chehab
2183059db434SRandy DunlapAVX512_elapsed_ms
2184c33e97efSMauro Carvalho Chehab^^^^^^^^^^^^^^^^^^
2185c33e97efSMauro Carvalho Chehab
2186c33e97efSMauro Carvalho Chehab  If AVX512 is supported on the machine, this entry shows the milliseconds
2187c33e97efSMauro Carvalho Chehab  elapsed since the last time AVX512 usage was recorded. The recording
2188c33e97efSMauro Carvalho Chehab  happens on a best effort basis when a task is scheduled out. This means
2189c33e97efSMauro Carvalho Chehab  that the value depends on two factors:
2190c33e97efSMauro Carvalho Chehab
2191c33e97efSMauro Carvalho Chehab    1) The time which the task spent on the CPU without being scheduled
2192c33e97efSMauro Carvalho Chehab       out. With CPU isolation and a single runnable task this can take
2193c33e97efSMauro Carvalho Chehab       several seconds.
2194c33e97efSMauro Carvalho Chehab
2195c33e97efSMauro Carvalho Chehab    2) The time since the task was scheduled out last. Depending on the
2196c33e97efSMauro Carvalho Chehab       reason for being scheduled out (time slice exhausted, syscall ...)
2197c33e97efSMauro Carvalho Chehab       this can be arbitrary long time.
2198c33e97efSMauro Carvalho Chehab
2199c33e97efSMauro Carvalho Chehab  As a consequence the value cannot be considered precise and authoritative
2200c33e97efSMauro Carvalho Chehab  information. The application which uses this information has to be aware
2201c33e97efSMauro Carvalho Chehab  of the overall scenario on the system in order to determine whether a
2202c33e97efSMauro Carvalho Chehab  task is a real AVX512 user or not. Precise information can be obtained
2203c33e97efSMauro Carvalho Chehab  with performance counters.
2204c33e97efSMauro Carvalho Chehab
2205c33e97efSMauro Carvalho Chehab  A special value of '-1' indicates that no AVX512 usage was recorded, thus
2206c33e97efSMauro Carvalho Chehab  the task is unlikely an AVX512 user, but depends on the workload and the
2207c33e97efSMauro Carvalho Chehab  scheduling scenario, it also could be a false negative mentioned above.
2208c33e97efSMauro Carvalho Chehab
2209f1f1f256SIvan Babrou3.13 /proc/<pid>/fd - List of symlinks to open files
2210f1f1f256SIvan Babrou-------------------------------------------------------
2211f1f1f256SIvan BabrouThis directory contains symbolic links which represent open files
2212f1f1f256SIvan Babrouthe process is maintaining.  Example output::
2213f1f1f256SIvan Babrou
2214f1f1f256SIvan Babrou  lr-x------ 1 root root 64 Sep 20 17:53 0 -> /dev/null
2215f1f1f256SIvan Babrou  l-wx------ 1 root root 64 Sep 20 17:53 1 -> /dev/null
2216f1f1f256SIvan Babrou  lrwx------ 1 root root 64 Sep 20 17:53 10 -> 'socket:[12539]'
2217f1f1f256SIvan Babrou  lrwx------ 1 root root 64 Sep 20 17:53 11 -> 'socket:[12540]'
2218f1f1f256SIvan Babrou  lrwx------ 1 root root 64 Sep 20 17:53 12 -> 'socket:[12542]'
2219f1f1f256SIvan Babrou
2220f1f1f256SIvan BabrouThe number of open files for the process is stored in 'size' member
2221f1f1f256SIvan Babrouof stat() output for /proc/<pid>/fd for fast access.
2222f1f1f256SIvan Babrou-------------------------------------------------------
2223f1f1f256SIvan Babrou
2224f1f1f256SIvan Babrou
2225059db434SRandy DunlapChapter 4: Configuring procfs
2226059db434SRandy Dunlap=============================
2227c33e97efSMauro Carvalho Chehab
2228c33e97efSMauro Carvalho Chehab4.1	Mount options
2229c33e97efSMauro Carvalho Chehab---------------------
2230c33e97efSMauro Carvalho Chehab
2231c33e97efSMauro Carvalho ChehabThe following mount options are supported:
2232c33e97efSMauro Carvalho Chehab
2233c33e97efSMauro Carvalho Chehab	=========	========================================================
2234c33e97efSMauro Carvalho Chehab	hidepid=	Set /proc/<pid>/ access mode.
2235c33e97efSMauro Carvalho Chehab	gid=		Set the group authorized to learn processes information.
223637e7647aSAlexey Gladkov	subset=		Show only the specified subset of procfs.
2237c33e97efSMauro Carvalho Chehab	=========	========================================================
2238c33e97efSMauro Carvalho Chehab
22391c6c4d11SAlexey Gladkovhidepid=off or hidepid=0 means classic mode - everybody may access all
22401c6c4d11SAlexey Gladkov/proc/<pid>/ directories (default).
2241c33e97efSMauro Carvalho Chehab
22421c6c4d11SAlexey Gladkovhidepid=noaccess or hidepid=1 means users may not access any /proc/<pid>/
22431c6c4d11SAlexey Gladkovdirectories but their own.  Sensitive files like cmdline, sched*, status are now
22441c6c4d11SAlexey Gladkovprotected against other users.  This makes it impossible to learn whether any
22451c6c4d11SAlexey Gladkovuser runs specific program (given the program doesn't reveal itself by its
22461c6c4d11SAlexey Gladkovbehaviour).  As an additional bonus, as /proc/<pid>/cmdline is unaccessible for
22471c6c4d11SAlexey Gladkovother users, poorly written programs passing sensitive information via program
22481c6c4d11SAlexey Gladkovarguments are now protected against local eavesdroppers.
2249c33e97efSMauro Carvalho Chehab
22501c6c4d11SAlexey Gladkovhidepid=invisible or hidepid=2 means hidepid=1 plus all /proc/<pid>/ will be
22511c6c4d11SAlexey Gladkovfully invisible to other users.  It doesn't mean that it hides a fact whether a
22521c6c4d11SAlexey Gladkovprocess with a specific pid value exists (it can be learned by other means, e.g.
22531c6c4d11SAlexey Gladkovby "kill -0 $PID"), but it hides process' uid and gid, which may be learned by
22541c6c4d11SAlexey Gladkovstat()'ing /proc/<pid>/ otherwise.  It greatly complicates an intruder's task of
22551c6c4d11SAlexey Gladkovgathering information about running processes, whether some daemon runs with
22561c6c4d11SAlexey Gladkovelevated privileges, whether other user runs some sensitive program, whether
22571c6c4d11SAlexey Gladkovother users run any program at all, etc.
2258c33e97efSMauro Carvalho Chehab
22591c6c4d11SAlexey Gladkovhidepid=ptraceable or hidepid=4 means that procfs should only contain
22601c6c4d11SAlexey Gladkov/proc/<pid>/ directories that the caller can ptrace.
2261c33e97efSMauro Carvalho Chehab
2262c33e97efSMauro Carvalho Chehabgid= defines a group authorized to learn processes information otherwise
2263c33e97efSMauro Carvalho Chehabprohibited by hidepid=.  If you use some daemon like identd which needs to learn
2264c33e97efSMauro Carvalho Chehabinformation about processes information, just add identd to this group.
226537e7647aSAlexey Gladkov
226637e7647aSAlexey Gladkovsubset=pid hides all top level files and directories in the procfs that
226737e7647aSAlexey Gladkovare not related to tasks.
226837e7647aSAlexey Gladkov
2269059db434SRandy DunlapChapter 5: Filesystem behavior
2270059db434SRandy Dunlap==============================
227137e7647aSAlexey Gladkov
2272d56b699dSBjorn HelgaasOriginally, before the advent of pid namespace, procfs was a global file
227337e7647aSAlexey Gladkovsystem. It means that there was only one procfs instance in the system.
227437e7647aSAlexey Gladkov
227537e7647aSAlexey GladkovWhen pid namespace was added, a separate procfs instance was mounted in
227637e7647aSAlexey Gladkoveach pid namespace. So, procfs mount options are global among all
2277565dbe72SMauro Carvalho Chehabmountpoints within the same namespace::
227837e7647aSAlexey Gladkov
227937e7647aSAlexey Gladkov	# grep ^proc /proc/mounts
228037e7647aSAlexey Gladkov	proc /proc proc rw,relatime,hidepid=2 0 0
228137e7647aSAlexey Gladkov
228237e7647aSAlexey Gladkov	# strace -e mount mount -o hidepid=1 -t proc proc /tmp/proc
228337e7647aSAlexey Gladkov	mount("proc", "/tmp/proc", "proc", 0, "hidepid=1") = 0
228437e7647aSAlexey Gladkov	+++ exited with 0 +++
228537e7647aSAlexey Gladkov
228637e7647aSAlexey Gladkov	# grep ^proc /proc/mounts
228737e7647aSAlexey Gladkov	proc /proc proc rw,relatime,hidepid=2 0 0
228837e7647aSAlexey Gladkov	proc /tmp/proc proc rw,relatime,hidepid=2 0 0
228937e7647aSAlexey Gladkov
229037e7647aSAlexey Gladkovand only after remounting procfs mount options will change at all
2291565dbe72SMauro Carvalho Chehabmountpoints::
229237e7647aSAlexey Gladkov
229337e7647aSAlexey Gladkov	# mount -o remount,hidepid=1 -t proc proc /tmp/proc
229437e7647aSAlexey Gladkov
229537e7647aSAlexey Gladkov	# grep ^proc /proc/mounts
229637e7647aSAlexey Gladkov	proc /proc proc rw,relatime,hidepid=1 0 0
229737e7647aSAlexey Gladkov	proc /tmp/proc proc rw,relatime,hidepid=1 0 0
229837e7647aSAlexey Gladkov
229937e7647aSAlexey GladkovThis behavior is different from the behavior of other filesystems.
230037e7647aSAlexey Gladkov
230137e7647aSAlexey GladkovThe new procfs behavior is more like other filesystems. Each procfs mount
230237e7647aSAlexey Gladkovcreates a new procfs instance. Mount options affect own procfs instance.
230337e7647aSAlexey GladkovIt means that it became possible to have several procfs instances
2304565dbe72SMauro Carvalho Chehabdisplaying tasks with different filtering options in one pid namespace::
230537e7647aSAlexey Gladkov
23061c6c4d11SAlexey Gladkov	# mount -o hidepid=invisible -t proc proc /proc
23071c6c4d11SAlexey Gladkov	# mount -o hidepid=noaccess -t proc proc /tmp/proc
230837e7647aSAlexey Gladkov	# grep ^proc /proc/mounts
23091c6c4d11SAlexey Gladkov	proc /proc proc rw,relatime,hidepid=invisible 0 0
23101c6c4d11SAlexey Gladkov	proc /tmp/proc proc rw,relatime,hidepid=noaccess 0 0
2311