18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci====================
48c2ecf20Sopenharmony_ciThe /proc Filesystem
58c2ecf20Sopenharmony_ci====================
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci=====================  =======================================  ================
88c2ecf20Sopenharmony_ci/proc/sys              Terrehon Bowden <terrehon@pacbell.net>,  October 7 1999
98c2ecf20Sopenharmony_ci                       Bodo Bauer <bb@ricochet.net>
108c2ecf20Sopenharmony_ci2.4.x update	       Jorge Nerin <comandante@zaralinux.com>   November 14 2000
118c2ecf20Sopenharmony_cimove /proc/sys	       Shen Feng <shen@cn.fujitsu.com>	        April 1 2009
128c2ecf20Sopenharmony_cifixes/update part 1.1  Stefani Seibold <stefani@seibold.net>    June 9 2009
138c2ecf20Sopenharmony_ci=====================  =======================================  ================
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci.. Table of Contents
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci  0     Preface
208c2ecf20Sopenharmony_ci  0.1	Introduction/Credits
218c2ecf20Sopenharmony_ci  0.2	Legal Stuff
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci  1	Collecting System Information
248c2ecf20Sopenharmony_ci  1.1	Process-Specific Subdirectories
258c2ecf20Sopenharmony_ci  1.2	Kernel data
268c2ecf20Sopenharmony_ci  1.3	IDE devices in /proc/ide
278c2ecf20Sopenharmony_ci  1.4	Networking info in /proc/net
288c2ecf20Sopenharmony_ci  1.5	SCSI info
298c2ecf20Sopenharmony_ci  1.6	Parallel port info in /proc/parport
308c2ecf20Sopenharmony_ci  1.7	TTY info in /proc/tty
318c2ecf20Sopenharmony_ci  1.8	Miscellaneous kernel statistics in /proc/stat
328c2ecf20Sopenharmony_ci  1.9	Ext4 file system parameters
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci  2	Modifying System Parameters
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci  3	Per-Process Parameters
378c2ecf20Sopenharmony_ci  3.1	/proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj - Adjust the oom-killer
388c2ecf20Sopenharmony_ci								score
398c2ecf20Sopenharmony_ci  3.2	/proc/<pid>/oom_score - Display current oom-killer score
408c2ecf20Sopenharmony_ci  3.3	/proc/<pid>/io - Display the IO accounting fields
418c2ecf20Sopenharmony_ci  3.4	/proc/<pid>/coredump_filter - Core dump filtering settings
428c2ecf20Sopenharmony_ci  3.5	/proc/<pid>/mountinfo - Information about mounts
438c2ecf20Sopenharmony_ci  3.6	/proc/<pid>/comm  & /proc/<pid>/task/<tid>/comm
448c2ecf20Sopenharmony_ci  3.7   /proc/<pid>/task/<tid>/children - Information about task children
458c2ecf20Sopenharmony_ci  3.8   /proc/<pid>/fdinfo/<fd> - Information about opened file
468c2ecf20Sopenharmony_ci  3.9   /proc/<pid>/map_files - Information about memory mapped files
478c2ecf20Sopenharmony_ci  3.10  /proc/<pid>/timerslack_ns - Task timerslack value
488c2ecf20Sopenharmony_ci  3.11	/proc/<pid>/patch_state - Livepatch patch operation state
498c2ecf20Sopenharmony_ci  3.12	/proc/<pid>/arch_status - Task architecture specific information
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci  4	Configuring procfs
528c2ecf20Sopenharmony_ci  4.1	Mount options
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci  5	Filesystem behavior
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciPreface
578c2ecf20Sopenharmony_ci=======
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci0.1 Introduction/Credits
608c2ecf20Sopenharmony_ci------------------------
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciThis documentation is  part of a soon (or  so we hope) to be  released book on
638c2ecf20Sopenharmony_cithe SuSE  Linux distribution. As  there is  no complete documentation  for the
648c2ecf20Sopenharmony_ci/proc file system and we've used  many freely available sources to write these
658c2ecf20Sopenharmony_cichapters, it  seems only fair  to give the work  back to the  Linux community.
668c2ecf20Sopenharmony_ciThis work is  based on the 2.2.*  kernel version and the  upcoming 2.4.*. I'm
678c2ecf20Sopenharmony_ciafraid it's still far from complete, but we  hope it will be useful. As far as
688c2ecf20Sopenharmony_ciwe know, it is the first 'all-in-one' document about the /proc file system. It
698c2ecf20Sopenharmony_ciis focused  on the Intel  x86 hardware,  so if you  are looking for  PPC, ARM,
708c2ecf20Sopenharmony_ciSPARC, AXP, etc., features, you probably  won't find what you are looking for.
718c2ecf20Sopenharmony_ciIt also only covers IPv4 networking, not IPv6 nor other protocols - sorry. But
728c2ecf20Sopenharmony_ciadditions and patches  are welcome and will  be added to this  document if you
738c2ecf20Sopenharmony_cimail them to Bodo.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciWe'd like  to  thank Alan Cox, Rik van Riel, and Alexey Kuznetsov and a lot of
768c2ecf20Sopenharmony_ciother people for help compiling this documentation. We'd also like to extend a
778c2ecf20Sopenharmony_cispecial thank  you to Andi Kleen for documentation, which we relied on heavily
788c2ecf20Sopenharmony_cito create  this  document,  as well as the additional information he provided.
798c2ecf20Sopenharmony_ciThanks to  everybody  else  who contributed source or docs to the Linux kernel
808c2ecf20Sopenharmony_ciand helped create a great piece of software... :)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciIf you  have  any comments, corrections or additions, please don't hesitate to
838c2ecf20Sopenharmony_cicontact Bodo  Bauer  at  bb@ricochet.net.  We'll  be happy to add them to this
848c2ecf20Sopenharmony_cidocument.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ciThe   latest   version    of   this   document   is    available   online   at
878c2ecf20Sopenharmony_cihttp://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciIf  the above  direction does  not works  for you,  you could  try the  kernel
908c2ecf20Sopenharmony_cimailing  list  at  linux-kernel@vger.kernel.org  and/or try  to  reach  me  at
918c2ecf20Sopenharmony_cicomandante@zaralinux.com.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci0.2 Legal Stuff
948c2ecf20Sopenharmony_ci---------------
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ciWe don't  guarantee  the  correctness  of this document, and if you come to us
978c2ecf20Sopenharmony_cicomplaining about  how  you  screwed  up  your  system  because  of  incorrect
988c2ecf20Sopenharmony_cidocumentation, we won't feel responsible...
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciChapter 1: Collecting System Information
1018c2ecf20Sopenharmony_ci========================================
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ciIn This Chapter
1048c2ecf20Sopenharmony_ci---------------
1058c2ecf20Sopenharmony_ci* Investigating  the  properties  of  the  pseudo  file  system  /proc and its
1068c2ecf20Sopenharmony_ci  ability to provide information on the running Linux system
1078c2ecf20Sopenharmony_ci* Examining /proc's structure
1088c2ecf20Sopenharmony_ci* Uncovering  various  information  about the kernel and the processes running
1098c2ecf20Sopenharmony_ci  on the system
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci------------------------------------------------------------------------------
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ciThe proc  file  system acts as an interface to internal data structures in the
1148c2ecf20Sopenharmony_cikernel. It  can  be  used to obtain information about the system and to change
1158c2ecf20Sopenharmony_cicertain kernel parameters at runtime (sysctl).
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ciFirst, we'll  take  a  look  at the read-only parts of /proc. In Chapter 2, we
1188c2ecf20Sopenharmony_cishow you how you can use /proc/sys to change settings.
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci1.1 Process-Specific Subdirectories
1218c2ecf20Sopenharmony_ci-----------------------------------
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciThe directory  /proc  contains  (among other things) one subdirectory for each
1248c2ecf20Sopenharmony_ciprocess running on the system, which is named after the process ID (PID).
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ciThe link  'self'  points to  the process reading the file system. Each process
1278c2ecf20Sopenharmony_cisubdirectory has the entries listed in Table 1-1.
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ciNote that an open file descriptor to /proc/<pid> or to any of its
1308c2ecf20Sopenharmony_cicontained files or subdirectories does not prevent <pid> being reused
1318c2ecf20Sopenharmony_cifor some other process in the event that <pid> exits. Operations on
1328c2ecf20Sopenharmony_ciopen /proc/<pid> file descriptors corresponding to dead processes
1338c2ecf20Sopenharmony_cinever act on any new process that the kernel may, through chance, have
1348c2ecf20Sopenharmony_cialso assigned the process ID <pid>. Instead, operations on these FDs
1358c2ecf20Sopenharmony_ciusually fail with ESRCH.
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci.. table:: Table 1-1: Process specific entries in /proc
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci =============  ===============================================================
1408c2ecf20Sopenharmony_ci File		Content
1418c2ecf20Sopenharmony_ci =============  ===============================================================
1428c2ecf20Sopenharmony_ci clear_refs	Clears page referenced bits shown in smaps output
1438c2ecf20Sopenharmony_ci cmdline	Command line arguments
1448c2ecf20Sopenharmony_ci cpu		Current and last cpu in which it was executed	(2.4)(smp)
1458c2ecf20Sopenharmony_ci cwd		Link to the current working directory
1468c2ecf20Sopenharmony_ci environ	Values of environment variables
1478c2ecf20Sopenharmony_ci exe		Link to the executable of this process
1488c2ecf20Sopenharmony_ci fd		Directory, which contains all file descriptors
1498c2ecf20Sopenharmony_ci maps		Memory maps to executables and library files	(2.4)
1508c2ecf20Sopenharmony_ci mem		Memory held by this process
1518c2ecf20Sopenharmony_ci root		Link to the root directory of this process
1528c2ecf20Sopenharmony_ci stat		Process status
1538c2ecf20Sopenharmony_ci statm		Process memory status information
1548c2ecf20Sopenharmony_ci status		Process status in human readable form
1558c2ecf20Sopenharmony_ci wchan		Present with CONFIG_KALLSYMS=y: it shows the kernel function
1568c2ecf20Sopenharmony_ci		symbol the task is blocked in - or "0" if not blocked.
1578c2ecf20Sopenharmony_ci pagemap	Page table
1588c2ecf20Sopenharmony_ci stack		Report full stack trace, enable via CONFIG_STACKTRACE
1598c2ecf20Sopenharmony_ci smaps		An extension based on maps, showing the memory consumption of
1608c2ecf20Sopenharmony_ci		each mapping and flags associated with it
1618c2ecf20Sopenharmony_ci smaps_rollup	Accumulated smaps stats for all mappings of the process.  This
1628c2ecf20Sopenharmony_ci		can be derived from smaps, but is faster and more convenient
1638c2ecf20Sopenharmony_ci numa_maps	An extension based on maps, showing the memory locality and
1648c2ecf20Sopenharmony_ci		binding policy as well as mem usage (in pages) of each mapping.
1658c2ecf20Sopenharmony_ci =============  ===============================================================
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ciFor example, to get the status information of a process, all you have to do is
1688c2ecf20Sopenharmony_ciread the file /proc/PID/status::
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci  >cat /proc/self/status
1718c2ecf20Sopenharmony_ci  Name:   cat
1728c2ecf20Sopenharmony_ci  State:  R (running)
1738c2ecf20Sopenharmony_ci  Tgid:   5452
1748c2ecf20Sopenharmony_ci  Pid:    5452
1758c2ecf20Sopenharmony_ci  PPid:   743
1768c2ecf20Sopenharmony_ci  TracerPid:      0						(2.4)
1778c2ecf20Sopenharmony_ci  Uid:    501     501     501     501
1788c2ecf20Sopenharmony_ci  Gid:    100     100     100     100
1798c2ecf20Sopenharmony_ci  FDSize: 256
1808c2ecf20Sopenharmony_ci  Groups: 100 14 16
1818c2ecf20Sopenharmony_ci  VmPeak:     5004 kB
1828c2ecf20Sopenharmony_ci  VmSize:     5004 kB
1838c2ecf20Sopenharmony_ci  VmLck:         0 kB
1848c2ecf20Sopenharmony_ci  VmHWM:       476 kB
1858c2ecf20Sopenharmony_ci  VmRSS:       476 kB
1868c2ecf20Sopenharmony_ci  RssAnon:             352 kB
1878c2ecf20Sopenharmony_ci  RssFile:             120 kB
1888c2ecf20Sopenharmony_ci  RssShmem:              4 kB
1898c2ecf20Sopenharmony_ci  VmData:      156 kB
1908c2ecf20Sopenharmony_ci  VmStk:        88 kB
1918c2ecf20Sopenharmony_ci  VmExe:        68 kB
1928c2ecf20Sopenharmony_ci  VmLib:      1412 kB
1938c2ecf20Sopenharmony_ci  VmPTE:        20 kb
1948c2ecf20Sopenharmony_ci  VmSwap:        0 kB
1958c2ecf20Sopenharmony_ci  HugetlbPages:          0 kB
1968c2ecf20Sopenharmony_ci  CoreDumping:    0
1978c2ecf20Sopenharmony_ci  THP_enabled:	  1
1988c2ecf20Sopenharmony_ci  Threads:        1
1998c2ecf20Sopenharmony_ci  SigQ:   0/28578
2008c2ecf20Sopenharmony_ci  SigPnd: 0000000000000000
2018c2ecf20Sopenharmony_ci  ShdPnd: 0000000000000000
2028c2ecf20Sopenharmony_ci  SigBlk: 0000000000000000
2038c2ecf20Sopenharmony_ci  SigIgn: 0000000000000000
2048c2ecf20Sopenharmony_ci  SigCgt: 0000000000000000
2058c2ecf20Sopenharmony_ci  CapInh: 00000000fffffeff
2068c2ecf20Sopenharmony_ci  CapPrm: 0000000000000000
2078c2ecf20Sopenharmony_ci  CapEff: 0000000000000000
2088c2ecf20Sopenharmony_ci  CapBnd: ffffffffffffffff
2098c2ecf20Sopenharmony_ci  CapAmb: 0000000000000000
2108c2ecf20Sopenharmony_ci  NoNewPrivs:     0
2118c2ecf20Sopenharmony_ci  Seccomp:        0
2128c2ecf20Sopenharmony_ci  Speculation_Store_Bypass:       thread vulnerable
2138c2ecf20Sopenharmony_ci  voluntary_ctxt_switches:        0
2148c2ecf20Sopenharmony_ci  nonvoluntary_ctxt_switches:     1
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ciThis shows you nearly the same information you would get if you viewed it with
2178c2ecf20Sopenharmony_cithe ps  command.  In  fact,  ps  uses  the  proc  file  system  to  obtain its
2188c2ecf20Sopenharmony_ciinformation.  But you get a more detailed  view of the  process by reading the
2198c2ecf20Sopenharmony_cifile /proc/PID/status. It fields are described in table 1-2.
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ciThe  statm  file  contains  more  detailed  information about the process
2228c2ecf20Sopenharmony_cimemory usage. Its seven fields are explained in Table 1-3.  The stat file
2238c2ecf20Sopenharmony_cicontains detailed information about the process itself.  Its fields are
2248c2ecf20Sopenharmony_ciexplained in Table 1-4.
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci(for SMP CONFIG users)
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ciFor making accounting scalable, RSS related information are handled in an
2298c2ecf20Sopenharmony_ciasynchronous manner and the value may not be very precise. To see a precise
2308c2ecf20Sopenharmony_cisnapshot of a moment, you can see /proc/<pid>/smaps file and scan page table.
2318c2ecf20Sopenharmony_ciIt's slow but very precise.
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci.. table:: Table 1-2: Contents of the status files (as of 4.19)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci ==========================  ===================================================
2368c2ecf20Sopenharmony_ci Field                       Content
2378c2ecf20Sopenharmony_ci ==========================  ===================================================
2388c2ecf20Sopenharmony_ci Name                        filename of the executable
2398c2ecf20Sopenharmony_ci Umask                       file mode creation mask
2408c2ecf20Sopenharmony_ci State                       state (R is running, S is sleeping, D is sleeping
2418c2ecf20Sopenharmony_ci                             in an uninterruptible wait, Z is zombie,
2428c2ecf20Sopenharmony_ci			     T is traced or stopped)
2438c2ecf20Sopenharmony_ci Tgid                        thread group ID
2448c2ecf20Sopenharmony_ci Ngid                        NUMA group ID (0 if none)
2458c2ecf20Sopenharmony_ci Pid                         process id
2468c2ecf20Sopenharmony_ci PPid                        process id of the parent process
2478c2ecf20Sopenharmony_ci TracerPid                   PID of process tracing this process (0 if not)
2488c2ecf20Sopenharmony_ci Uid                         Real, effective, saved set, and  file system UIDs
2498c2ecf20Sopenharmony_ci Gid                         Real, effective, saved set, and  file system GIDs
2508c2ecf20Sopenharmony_ci FDSize                      number of file descriptor slots currently allocated
2518c2ecf20Sopenharmony_ci Groups                      supplementary group list
2528c2ecf20Sopenharmony_ci NStgid                      descendant namespace thread group ID hierarchy
2538c2ecf20Sopenharmony_ci NSpid                       descendant namespace process ID hierarchy
2548c2ecf20Sopenharmony_ci NSpgid                      descendant namespace process group ID hierarchy
2558c2ecf20Sopenharmony_ci NSsid                       descendant namespace session ID hierarchy
2568c2ecf20Sopenharmony_ci VmPeak                      peak virtual memory size
2578c2ecf20Sopenharmony_ci VmSize                      total program size
2588c2ecf20Sopenharmony_ci VmLck                       locked memory size
2598c2ecf20Sopenharmony_ci VmPin                       pinned memory size
2608c2ecf20Sopenharmony_ci VmHWM                       peak resident set size ("high water mark")
2618c2ecf20Sopenharmony_ci VmRSS                       size of memory portions. It contains the three
2628c2ecf20Sopenharmony_ci                             following parts
2638c2ecf20Sopenharmony_ci                             (VmRSS = RssAnon + RssFile + RssShmem)
2648c2ecf20Sopenharmony_ci RssAnon                     size of resident anonymous memory
2658c2ecf20Sopenharmony_ci RssFile                     size of resident file mappings
2668c2ecf20Sopenharmony_ci RssShmem                    size of resident shmem memory (includes SysV shm,
2678c2ecf20Sopenharmony_ci                             mapping of tmpfs and shared anonymous mappings)
2688c2ecf20Sopenharmony_ci VmData                      size of private data segments
2698c2ecf20Sopenharmony_ci VmStk                       size of stack segments
2708c2ecf20Sopenharmony_ci VmExe                       size of text segment
2718c2ecf20Sopenharmony_ci VmLib                       size of shared library code
2728c2ecf20Sopenharmony_ci VmPTE                       size of page table entries
2738c2ecf20Sopenharmony_ci VmSwap                      amount of swap used by anonymous private data
2748c2ecf20Sopenharmony_ci                             (shmem swap usage is not included)
2758c2ecf20Sopenharmony_ci HugetlbPages                size of hugetlb memory portions
2768c2ecf20Sopenharmony_ci CoreDumping                 process's memory is currently being dumped
2778c2ecf20Sopenharmony_ci                             (killing the process may lead to a corrupted core)
2788c2ecf20Sopenharmony_ci THP_enabled		     process is allowed to use THP (returns 0 when
2798c2ecf20Sopenharmony_ci			     PR_SET_THP_DISABLE is set on the process
2808c2ecf20Sopenharmony_ci Threads                     number of threads
2818c2ecf20Sopenharmony_ci SigQ                        number of signals queued/max. number for queue
2828c2ecf20Sopenharmony_ci SigPnd                      bitmap of pending signals for the thread
2838c2ecf20Sopenharmony_ci ShdPnd                      bitmap of shared pending signals for the process
2848c2ecf20Sopenharmony_ci SigBlk                      bitmap of blocked signals
2858c2ecf20Sopenharmony_ci SigIgn                      bitmap of ignored signals
2868c2ecf20Sopenharmony_ci SigCgt                      bitmap of caught signals
2878c2ecf20Sopenharmony_ci CapInh                      bitmap of inheritable capabilities
2888c2ecf20Sopenharmony_ci CapPrm                      bitmap of permitted capabilities
2898c2ecf20Sopenharmony_ci CapEff                      bitmap of effective capabilities
2908c2ecf20Sopenharmony_ci CapBnd                      bitmap of capabilities bounding set
2918c2ecf20Sopenharmony_ci CapAmb                      bitmap of ambient capabilities
2928c2ecf20Sopenharmony_ci NoNewPrivs                  no_new_privs, like prctl(PR_GET_NO_NEW_PRIV, ...)
2938c2ecf20Sopenharmony_ci Seccomp                     seccomp mode, like prctl(PR_GET_SECCOMP, ...)
2948c2ecf20Sopenharmony_ci Speculation_Store_Bypass    speculative store bypass mitigation status
2958c2ecf20Sopenharmony_ci Cpus_allowed                mask of CPUs on which this process may run
2968c2ecf20Sopenharmony_ci Cpus_allowed_list           Same as previous, but in "list format"
2978c2ecf20Sopenharmony_ci Mems_allowed                mask of memory nodes allowed to this process
2988c2ecf20Sopenharmony_ci Mems_allowed_list           Same as previous, but in "list format"
2998c2ecf20Sopenharmony_ci voluntary_ctxt_switches     number of voluntary context switches
3008c2ecf20Sopenharmony_ci nonvoluntary_ctxt_switches  number of non voluntary context switches
3018c2ecf20Sopenharmony_ci ==========================  ===================================================
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci.. table:: Table 1-3: Contents of the statm files (as of 2.6.8-rc3)
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci ======== ===============================	==============================
3078c2ecf20Sopenharmony_ci Field    Content
3088c2ecf20Sopenharmony_ci ======== ===============================	==============================
3098c2ecf20Sopenharmony_ci size     total program size (pages)		(same as VmSize in status)
3108c2ecf20Sopenharmony_ci resident size of memory portions (pages)	(same as VmRSS in status)
3118c2ecf20Sopenharmony_ci shared   number of pages that are shared	(i.e. backed by a file, same
3128c2ecf20Sopenharmony_ci						as RssFile+RssShmem in status)
3138c2ecf20Sopenharmony_ci trs      number of pages that are 'code'	(not including libs; broken,
3148c2ecf20Sopenharmony_ci						includes data segment)
3158c2ecf20Sopenharmony_ci lrs      number of pages of library		(always 0 on 2.6)
3168c2ecf20Sopenharmony_ci drs      number of pages of data/stack		(including libs; broken,
3178c2ecf20Sopenharmony_ci						includes library text)
3188c2ecf20Sopenharmony_ci dt       number of dirty pages			(always 0 on 2.6)
3198c2ecf20Sopenharmony_ci ======== ===============================	==============================
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci.. table:: Table 1-4: Contents of the stat files (as of 2.6.30-rc7)
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci  ============= ===============================================================
3258c2ecf20Sopenharmony_ci  Field         Content
3268c2ecf20Sopenharmony_ci  ============= ===============================================================
3278c2ecf20Sopenharmony_ci  pid           process id
3288c2ecf20Sopenharmony_ci  tcomm         filename of the executable
3298c2ecf20Sopenharmony_ci  state         state (R is running, S is sleeping, D is sleeping in an
3308c2ecf20Sopenharmony_ci                uninterruptible wait, Z is zombie, T is traced or stopped)
3318c2ecf20Sopenharmony_ci  ppid          process id of the parent process
3328c2ecf20Sopenharmony_ci  pgrp          pgrp of the process
3338c2ecf20Sopenharmony_ci  sid           session id
3348c2ecf20Sopenharmony_ci  tty_nr        tty the process uses
3358c2ecf20Sopenharmony_ci  tty_pgrp      pgrp of the tty
3368c2ecf20Sopenharmony_ci  flags         task flags
3378c2ecf20Sopenharmony_ci  min_flt       number of minor faults
3388c2ecf20Sopenharmony_ci  cmin_flt      number of minor faults with child's
3398c2ecf20Sopenharmony_ci  maj_flt       number of major faults
3408c2ecf20Sopenharmony_ci  cmaj_flt      number of major faults with child's
3418c2ecf20Sopenharmony_ci  utime         user mode jiffies
3428c2ecf20Sopenharmony_ci  stime         kernel mode jiffies
3438c2ecf20Sopenharmony_ci  cutime        user mode jiffies with child's
3448c2ecf20Sopenharmony_ci  cstime        kernel mode jiffies with child's
3458c2ecf20Sopenharmony_ci  priority      priority level
3468c2ecf20Sopenharmony_ci  nice          nice level
3478c2ecf20Sopenharmony_ci  num_threads   number of threads
3488c2ecf20Sopenharmony_ci  it_real_value	(obsolete, always 0)
3498c2ecf20Sopenharmony_ci  start_time    time the process started after system boot
3508c2ecf20Sopenharmony_ci  vsize         virtual memory size
3518c2ecf20Sopenharmony_ci  rss           resident set memory size
3528c2ecf20Sopenharmony_ci  rsslim        current limit in bytes on the rss
3538c2ecf20Sopenharmony_ci  start_code    address above which program text can run
3548c2ecf20Sopenharmony_ci  end_code      address below which program text can run
3558c2ecf20Sopenharmony_ci  start_stack   address of the start of the main process stack
3568c2ecf20Sopenharmony_ci  esp           current value of ESP
3578c2ecf20Sopenharmony_ci  eip           current value of EIP
3588c2ecf20Sopenharmony_ci  pending       bitmap of pending signals
3598c2ecf20Sopenharmony_ci  blocked       bitmap of blocked signals
3608c2ecf20Sopenharmony_ci  sigign        bitmap of ignored signals
3618c2ecf20Sopenharmony_ci  sigcatch      bitmap of caught signals
3628c2ecf20Sopenharmony_ci  0		(place holder, used to be the wchan address,
3638c2ecf20Sopenharmony_ci		use /proc/PID/wchan instead)
3648c2ecf20Sopenharmony_ci  0             (place holder)
3658c2ecf20Sopenharmony_ci  0             (place holder)
3668c2ecf20Sopenharmony_ci  exit_signal   signal to send to parent thread on exit
3678c2ecf20Sopenharmony_ci  task_cpu      which CPU the task is scheduled on
3688c2ecf20Sopenharmony_ci  rt_priority   realtime priority
3698c2ecf20Sopenharmony_ci  policy        scheduling policy (man sched_setscheduler)
3708c2ecf20Sopenharmony_ci  blkio_ticks   time spent waiting for block IO
3718c2ecf20Sopenharmony_ci  gtime         guest time of the task in jiffies
3728c2ecf20Sopenharmony_ci  cgtime        guest time of the task children in jiffies
3738c2ecf20Sopenharmony_ci  start_data    address above which program data+bss is placed
3748c2ecf20Sopenharmony_ci  end_data      address below which program data+bss is placed
3758c2ecf20Sopenharmony_ci  start_brk     address above which program heap can be expanded with brk()
3768c2ecf20Sopenharmony_ci  arg_start     address above which program command line is placed
3778c2ecf20Sopenharmony_ci  arg_end       address below which program command line is placed
3788c2ecf20Sopenharmony_ci  env_start     address above which program environment is placed
3798c2ecf20Sopenharmony_ci  env_end       address below which program environment is placed
3808c2ecf20Sopenharmony_ci  exit_code     the thread's exit_code in the form reported by the waitpid
3818c2ecf20Sopenharmony_ci		system call
3828c2ecf20Sopenharmony_ci  ============= ===============================================================
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ciThe /proc/PID/maps file contains the currently mapped memory regions and
3858c2ecf20Sopenharmony_citheir access permissions.
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ciThe format is::
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci    address           perms offset  dev   inode      pathname
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci    08048000-08049000 r-xp 00000000 03:00 8312       /opt/test
3928c2ecf20Sopenharmony_ci    08049000-0804a000 rw-p 00001000 03:00 8312       /opt/test
3938c2ecf20Sopenharmony_ci    0804a000-0806b000 rw-p 00000000 00:00 0          [heap]
3948c2ecf20Sopenharmony_ci    a7cb1000-a7cb2000 ---p 00000000 00:00 0
3958c2ecf20Sopenharmony_ci    a7cb2000-a7eb2000 rw-p 00000000 00:00 0
3968c2ecf20Sopenharmony_ci    a7eb2000-a7eb3000 ---p 00000000 00:00 0
3978c2ecf20Sopenharmony_ci    a7eb3000-a7ed5000 rw-p 00000000 00:00 0
3988c2ecf20Sopenharmony_ci    a7ed5000-a8008000 r-xp 00000000 03:00 4222       /lib/libc.so.6
3998c2ecf20Sopenharmony_ci    a8008000-a800a000 r--p 00133000 03:00 4222       /lib/libc.so.6
4008c2ecf20Sopenharmony_ci    a800a000-a800b000 rw-p 00135000 03:00 4222       /lib/libc.so.6
4018c2ecf20Sopenharmony_ci    a800b000-a800e000 rw-p 00000000 00:00 0
4028c2ecf20Sopenharmony_ci    a800e000-a8022000 r-xp 00000000 03:00 14462      /lib/libpthread.so.0
4038c2ecf20Sopenharmony_ci    a8022000-a8023000 r--p 00013000 03:00 14462      /lib/libpthread.so.0
4048c2ecf20Sopenharmony_ci    a8023000-a8024000 rw-p 00014000 03:00 14462      /lib/libpthread.so.0
4058c2ecf20Sopenharmony_ci    a8024000-a8027000 rw-p 00000000 00:00 0
4068c2ecf20Sopenharmony_ci    a8027000-a8043000 r-xp 00000000 03:00 8317       /lib/ld-linux.so.2
4078c2ecf20Sopenharmony_ci    a8043000-a8044000 r--p 0001b000 03:00 8317       /lib/ld-linux.so.2
4088c2ecf20Sopenharmony_ci    a8044000-a8045000 rw-p 0001c000 03:00 8317       /lib/ld-linux.so.2
4098c2ecf20Sopenharmony_ci    aff35000-aff4a000 rw-p 00000000 00:00 0          [stack]
4108c2ecf20Sopenharmony_ci    ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ciwhere "address" is the address space in the process that it occupies, "perms"
4138c2ecf20Sopenharmony_ciis a set of permissions::
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci r = read
4168c2ecf20Sopenharmony_ci w = write
4178c2ecf20Sopenharmony_ci x = execute
4188c2ecf20Sopenharmony_ci s = shared
4198c2ecf20Sopenharmony_ci p = private (copy on write)
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci"offset" is the offset into the mapping, "dev" is the device (major:minor), and
4228c2ecf20Sopenharmony_ci"inode" is the inode  on that device.  0 indicates that  no inode is associated
4238c2ecf20Sopenharmony_ciwith the memory region, as the case would be with BSS (uninitialized data).
4248c2ecf20Sopenharmony_ciThe "pathname" shows the name associated file for this mapping.  If the mapping
4258c2ecf20Sopenharmony_ciis not associated with a file:
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci =======                    ====================================
4288c2ecf20Sopenharmony_ci [heap]                     the heap of the program
4298c2ecf20Sopenharmony_ci [stack]                    the stack of the main process
4308c2ecf20Sopenharmony_ci [vdso]                     the "virtual dynamic shared object",
4318c2ecf20Sopenharmony_ci                            the kernel system call handler
4328c2ecf20Sopenharmony_ci[anon:<name>]               an anonymous mapping that has been
4338c2ecf20Sopenharmony_ci                            named by userspace
4348c2ecf20Sopenharmony_ci =======                    ====================================
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci or if empty, the mapping is anonymous.
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ciThe /proc/PID/smaps is an extension based on maps, showing the memory
4398c2ecf20Sopenharmony_ciconsumption for each of the process's mappings. For each mapping (aka Virtual
4408c2ecf20Sopenharmony_ciMemory Area, or VMA) there is a series of lines such as the following::
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci    08048000-080bc000 r-xp 00000000 03:02 13130      /bin/bash
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci    Size:               1084 kB
4458c2ecf20Sopenharmony_ci    KernelPageSize:        4 kB
4468c2ecf20Sopenharmony_ci    MMUPageSize:           4 kB
4478c2ecf20Sopenharmony_ci    Rss:                 892 kB
4488c2ecf20Sopenharmony_ci    Pss:                 374 kB
4498c2ecf20Sopenharmony_ci    Shared_Clean:        892 kB
4508c2ecf20Sopenharmony_ci    Shared_Dirty:          0 kB
4518c2ecf20Sopenharmony_ci    Private_Clean:         0 kB
4528c2ecf20Sopenharmony_ci    Private_Dirty:         0 kB
4538c2ecf20Sopenharmony_ci    Referenced:          892 kB
4548c2ecf20Sopenharmony_ci    Anonymous:             0 kB
4558c2ecf20Sopenharmony_ci    LazyFree:              0 kB
4568c2ecf20Sopenharmony_ci    AnonHugePages:         0 kB
4578c2ecf20Sopenharmony_ci    ShmemPmdMapped:        0 kB
4588c2ecf20Sopenharmony_ci    Shared_Hugetlb:        0 kB
4598c2ecf20Sopenharmony_ci    Private_Hugetlb:       0 kB
4608c2ecf20Sopenharmony_ci    Swap:                  0 kB
4618c2ecf20Sopenharmony_ci    SwapPss:               0 kB
4628c2ecf20Sopenharmony_ci    KernelPageSize:        4 kB
4638c2ecf20Sopenharmony_ci    MMUPageSize:           4 kB
4648c2ecf20Sopenharmony_ci    Locked:                0 kB
4658c2ecf20Sopenharmony_ci    THPeligible:           0
4668c2ecf20Sopenharmony_ci    VmFlags: rd ex mr mw me dw
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ciThe first of these lines shows the same information as is displayed for the
4698c2ecf20Sopenharmony_cimapping in /proc/PID/maps.  Following lines show the size of the mapping
4708c2ecf20Sopenharmony_ci(size); the size of each page allocated when backing a VMA (KernelPageSize),
4718c2ecf20Sopenharmony_ciwhich is usually the same as the size in the page table entries; the page size
4728c2ecf20Sopenharmony_ciused by the MMU when backing a VMA (in most cases, the same as KernelPageSize);
4738c2ecf20Sopenharmony_cithe amount of the mapping that is currently resident in RAM (RSS); the
4748c2ecf20Sopenharmony_ciprocess' proportional share of this mapping (PSS); and the number of clean and
4758c2ecf20Sopenharmony_cidirty shared and private pages in the mapping.
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ciThe "proportional set size" (PSS) of a process is the count of pages it has
4788c2ecf20Sopenharmony_ciin memory, where each page is divided by the number of processes sharing it.
4798c2ecf20Sopenharmony_ciSo if a process has 1000 pages all to itself, and 1000 shared with one other
4808c2ecf20Sopenharmony_ciprocess, its PSS will be 1500.
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ciNote that even a page which is part of a MAP_SHARED mapping, but has only
4838c2ecf20Sopenharmony_cia single pte mapped, i.e.  is currently used by only one process, is accounted
4848c2ecf20Sopenharmony_cias private and not as shared.
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci"Referenced" indicates the amount of memory currently marked as referenced or
4878c2ecf20Sopenharmony_ciaccessed.
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci"Anonymous" shows the amount of memory that does not belong to any file.  Even
4908c2ecf20Sopenharmony_cia mapping associated with a file may contain anonymous pages: when MAP_PRIVATE
4918c2ecf20Sopenharmony_ciand a page is modified, the file page is replaced by a private anonymous copy.
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci"LazyFree" shows the amount of memory which is marked by madvise(MADV_FREE).
4948c2ecf20Sopenharmony_ciThe memory isn't freed immediately with madvise(). It's freed in memory
4958c2ecf20Sopenharmony_cipressure if the memory is clean. Please note that the printed value might
4968c2ecf20Sopenharmony_cibe lower than the real value due to optimizations used in the current
4978c2ecf20Sopenharmony_ciimplementation. If this is not desirable please file a bug report.
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci"AnonHugePages" shows the ammount of memory backed by transparent hugepage.
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci"ShmemPmdMapped" shows the ammount of shared (shmem/tmpfs) memory backed by
5028c2ecf20Sopenharmony_cihuge pages.
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci"Shared_Hugetlb" and "Private_Hugetlb" show the ammounts of memory backed by
5058c2ecf20Sopenharmony_cihugetlbfs page which is *not* counted in "RSS" or "PSS" field for historical
5068c2ecf20Sopenharmony_cireasons. And these are not included in {Shared,Private}_{Clean,Dirty} field.
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci"Swap" shows how much would-be-anonymous memory is also used, but out on swap.
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ciFor shmem mappings, "Swap" includes also the size of the mapped (and not
5118c2ecf20Sopenharmony_cireplaced by copy-on-write) part of the underlying shmem object out on swap.
5128c2ecf20Sopenharmony_ci"SwapPss" shows proportional swap share of this mapping. Unlike "Swap", this
5138c2ecf20Sopenharmony_cidoes not take into account swapped out page of underlying shmem objects.
5148c2ecf20Sopenharmony_ci"Locked" indicates whether the mapping is locked in memory or not.
5158c2ecf20Sopenharmony_ci"THPeligible" indicates whether the mapping is eligible for allocating THP
5168c2ecf20Sopenharmony_cipages - 1 if true, 0 otherwise. It just shows the current status.
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci"VmFlags" field deserves a separate description. This member represents the
5198c2ecf20Sopenharmony_cikernel flags associated with the particular virtual memory area in two letter
5208c2ecf20Sopenharmony_ciencoded manner. The codes are the following:
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci    ==    =======================================
5238c2ecf20Sopenharmony_ci    rd    readable
5248c2ecf20Sopenharmony_ci    wr    writeable
5258c2ecf20Sopenharmony_ci    ex    executable
5268c2ecf20Sopenharmony_ci    sh    shared
5278c2ecf20Sopenharmony_ci    mr    may read
5288c2ecf20Sopenharmony_ci    mw    may write
5298c2ecf20Sopenharmony_ci    me    may execute
5308c2ecf20Sopenharmony_ci    ms    may share
5318c2ecf20Sopenharmony_ci    gd    stack segment growns down
5328c2ecf20Sopenharmony_ci    pf    pure PFN range
5338c2ecf20Sopenharmony_ci    dw    disabled write to the mapped file
5348c2ecf20Sopenharmony_ci    lo    pages are locked in memory
5358c2ecf20Sopenharmony_ci    io    memory mapped I/O area
5368c2ecf20Sopenharmony_ci    sr    sequential read advise provided
5378c2ecf20Sopenharmony_ci    rr    random read advise provided
5388c2ecf20Sopenharmony_ci    dc    do not copy area on fork
5398c2ecf20Sopenharmony_ci    de    do not expand area on remapping
5408c2ecf20Sopenharmony_ci    ac    area is accountable
5418c2ecf20Sopenharmony_ci    nr    swap space is not reserved for the area
5428c2ecf20Sopenharmony_ci    ht    area uses huge tlb pages
5438c2ecf20Sopenharmony_ci    ar    architecture specific flag
5448c2ecf20Sopenharmony_ci    dd    do not include area into core dump
5458c2ecf20Sopenharmony_ci    sd    soft dirty flag
5468c2ecf20Sopenharmony_ci    mm    mixed map area
5478c2ecf20Sopenharmony_ci    hg    huge page advise flag
5488c2ecf20Sopenharmony_ci    nh    no huge page advise flag
5498c2ecf20Sopenharmony_ci    mg    mergable advise flag
5508c2ecf20Sopenharmony_ci    bt    arm64 BTI guarded page
5518c2ecf20Sopenharmony_ci    ==    =======================================
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ciNote that there is no guarantee that every flag and associated mnemonic will
5548c2ecf20Sopenharmony_cibe present in all further kernel releases. Things get changed, the flags may
5558c2ecf20Sopenharmony_cibe vanished or the reverse -- new added. Interpretation of their meaning
5568c2ecf20Sopenharmony_cimight change in future as well. So each consumer of these flags has to
5578c2ecf20Sopenharmony_cifollow each specific kernel version for the exact semantic.
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ciThis file is only present if the CONFIG_MMU kernel configuration option is
5608c2ecf20Sopenharmony_cienabled.
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ciNote: reading /proc/PID/maps or /proc/PID/smaps is inherently racy (consistent
5638c2ecf20Sopenharmony_cioutput can be achieved only in the single read call).
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ciThis typically manifests when doing partial reads of these files while the
5668c2ecf20Sopenharmony_cimemory map is being modified.  Despite the races, we do provide the following
5678c2ecf20Sopenharmony_ciguarantees:
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci1) The mapped addresses never go backwards, which implies no two
5708c2ecf20Sopenharmony_ci   regions will ever overlap.
5718c2ecf20Sopenharmony_ci2) If there is something at a given vaddr during the entirety of the
5728c2ecf20Sopenharmony_ci   life of the smaps/maps walk, there will be some output for it.
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ciThe /proc/PID/smaps_rollup file includes the same fields as /proc/PID/smaps,
5758c2ecf20Sopenharmony_cibut their values are the sums of the corresponding values for all mappings of
5768c2ecf20Sopenharmony_cithe process.  Additionally, it contains these fields:
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci- Pss_Anon
5798c2ecf20Sopenharmony_ci- Pss_File
5808c2ecf20Sopenharmony_ci- Pss_Shmem
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ciThey represent the proportional shares of anonymous, file, and shmem pages, as
5838c2ecf20Sopenharmony_cidescribed for smaps above.  These fields are omitted in smaps since each
5848c2ecf20Sopenharmony_cimapping identifies the type (anon, file, or shmem) of all pages it contains.
5858c2ecf20Sopenharmony_ciThus all information in smaps_rollup can be derived from smaps, but at a
5868c2ecf20Sopenharmony_cisignificantly higher cost.
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ciThe /proc/PID/clear_refs is used to reset the PG_Referenced and ACCESSED/YOUNG
5898c2ecf20Sopenharmony_cibits on both physical and virtual pages associated with a process, and the
5908c2ecf20Sopenharmony_cisoft-dirty bit on pte (see Documentation/admin-guide/mm/soft-dirty.rst
5918c2ecf20Sopenharmony_cifor details).
5928c2ecf20Sopenharmony_ciTo clear the bits for all the pages associated with the process::
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci    > echo 1 > /proc/PID/clear_refs
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ciTo clear the bits for the anonymous pages associated with the process::
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci    > echo 2 > /proc/PID/clear_refs
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ciTo clear the bits for the file mapped pages associated with the process::
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci    > echo 3 > /proc/PID/clear_refs
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ciTo clear the soft-dirty bit::
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci    > echo 4 > /proc/PID/clear_refs
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ciTo reset the peak resident set size ("high water mark") to the process's
6098c2ecf20Sopenharmony_cicurrent value::
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci    > echo 5 > /proc/PID/clear_refs
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ciAny other value written to /proc/PID/clear_refs will have no effect.
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ciThe /proc/pid/pagemap gives the PFN, which can be used to find the pageflags
6168c2ecf20Sopenharmony_ciusing /proc/kpageflags and number of times a page is mapped using
6178c2ecf20Sopenharmony_ci/proc/kpagecount. For detailed explanation, see
6188c2ecf20Sopenharmony_ciDocumentation/admin-guide/mm/pagemap.rst.
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ciThe /proc/pid/numa_maps is an extension based on maps, showing the memory
6218c2ecf20Sopenharmony_cilocality and binding policy, as well as the memory usage (in pages) of
6228c2ecf20Sopenharmony_cieach mapping. The output follows a general format where mapping details get
6238c2ecf20Sopenharmony_cisummarized separated by blank spaces, one mapping per each file line::
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci    address   policy    mapping details
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci    00400000 default file=/usr/local/bin/app mapped=1 active=0 N3=1 kernelpagesize_kB=4
6288c2ecf20Sopenharmony_ci    00600000 default file=/usr/local/bin/app anon=1 dirty=1 N3=1 kernelpagesize_kB=4
6298c2ecf20Sopenharmony_ci    3206000000 default file=/lib64/ld-2.12.so mapped=26 mapmax=6 N0=24 N3=2 kernelpagesize_kB=4
6308c2ecf20Sopenharmony_ci    320621f000 default file=/lib64/ld-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
6318c2ecf20Sopenharmony_ci    3206220000 default file=/lib64/ld-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
6328c2ecf20Sopenharmony_ci    3206221000 default anon=1 dirty=1 N3=1 kernelpagesize_kB=4
6338c2ecf20Sopenharmony_ci    3206800000 default file=/lib64/libc-2.12.so mapped=59 mapmax=21 active=55 N0=41 N3=18 kernelpagesize_kB=4
6348c2ecf20Sopenharmony_ci    320698b000 default file=/lib64/libc-2.12.so
6358c2ecf20Sopenharmony_ci    3206b8a000 default file=/lib64/libc-2.12.so anon=2 dirty=2 N3=2 kernelpagesize_kB=4
6368c2ecf20Sopenharmony_ci    3206b8e000 default file=/lib64/libc-2.12.so anon=1 dirty=1 N3=1 kernelpagesize_kB=4
6378c2ecf20Sopenharmony_ci    3206b8f000 default anon=3 dirty=3 active=1 N3=3 kernelpagesize_kB=4
6388c2ecf20Sopenharmony_ci    7f4dc10a2000 default anon=3 dirty=3 N3=3 kernelpagesize_kB=4
6398c2ecf20Sopenharmony_ci    7f4dc10b4000 default anon=2 dirty=2 active=1 N3=2 kernelpagesize_kB=4
6408c2ecf20Sopenharmony_ci    7f4dc1200000 default file=/anon_hugepage\040(deleted) huge anon=1 dirty=1 N3=1 kernelpagesize_kB=2048
6418c2ecf20Sopenharmony_ci    7fff335f0000 default stack anon=3 dirty=3 N3=3 kernelpagesize_kB=4
6428c2ecf20Sopenharmony_ci    7fff3369d000 default mapped=1 mapmax=35 active=0 N3=1 kernelpagesize_kB=4
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ciWhere:
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ci"address" is the starting address for the mapping;
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci"policy" reports the NUMA memory policy set for the mapping (see Documentation/admin-guide/mm/numa_memory_policy.rst);
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci"mapping details" summarizes mapping data such as mapping type, page usage counters,
6518c2ecf20Sopenharmony_cinode locality page counters (N0 == node0, N1 == node1, ...) and the kernel page
6528c2ecf20Sopenharmony_cisize, in KB, that is backing the mapping up.
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci1.2 Kernel data
6558c2ecf20Sopenharmony_ci---------------
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ciSimilar to  the  process entries, the kernel data files give information about
6588c2ecf20Sopenharmony_cithe running kernel. The files used to obtain this information are contained in
6598c2ecf20Sopenharmony_ci/proc and  are  listed  in Table 1-5. Not all of these will be present in your
6608c2ecf20Sopenharmony_cisystem. It  depends  on the kernel configuration and the loaded modules, which
6618c2ecf20Sopenharmony_cifiles are there, and which are missing.
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci.. table:: Table 1-5: Kernel info in /proc
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci ============ ===============================================================
6668c2ecf20Sopenharmony_ci File         Content
6678c2ecf20Sopenharmony_ci ============ ===============================================================
6688c2ecf20Sopenharmony_ci apm          Advanced power management info
6698c2ecf20Sopenharmony_ci buddyinfo    Kernel memory allocator information (see text)	(2.5)
6708c2ecf20Sopenharmony_ci bus          Directory containing bus specific information
6718c2ecf20Sopenharmony_ci cmdline      Kernel command line
6728c2ecf20Sopenharmony_ci cpuinfo      Info about the CPU
6738c2ecf20Sopenharmony_ci devices      Available devices (block and character)
6748c2ecf20Sopenharmony_ci dma          Used DMS channels
6758c2ecf20Sopenharmony_ci filesystems  Supported filesystems
6768c2ecf20Sopenharmony_ci driver       Various drivers grouped here, currently rtc	(2.4)
6778c2ecf20Sopenharmony_ci execdomains  Execdomains, related to security			(2.4)
6788c2ecf20Sopenharmony_ci fb 	      Frame Buffer devices				(2.4)
6798c2ecf20Sopenharmony_ci fs 	      File system parameters, currently nfs/exports	(2.4)
6808c2ecf20Sopenharmony_ci ide          Directory containing info about the IDE subsystem
6818c2ecf20Sopenharmony_ci interrupts   Interrupt usage
6828c2ecf20Sopenharmony_ci iomem 	      Memory map					(2.4)
6838c2ecf20Sopenharmony_ci ioports      I/O port usage
6848c2ecf20Sopenharmony_ci irq 	      Masks for irq to cpu affinity			(2.4)(smp?)
6858c2ecf20Sopenharmony_ci isapnp       ISA PnP (Plug&Play) Info				(2.4)
6868c2ecf20Sopenharmony_ci kcore        Kernel core image (can be ELF or A.OUT(deprecated in 2.4))
6878c2ecf20Sopenharmony_ci kmsg         Kernel messages
6888c2ecf20Sopenharmony_ci ksyms        Kernel symbol table
6898c2ecf20Sopenharmony_ci loadavg      Load average of last 1, 5 & 15 minutes
6908c2ecf20Sopenharmony_ci locks        Kernel locks
6918c2ecf20Sopenharmony_ci meminfo      Memory info
6928c2ecf20Sopenharmony_ci misc         Miscellaneous
6938c2ecf20Sopenharmony_ci modules      List of loaded modules
6948c2ecf20Sopenharmony_ci mounts       Mounted filesystems
6958c2ecf20Sopenharmony_ci net          Networking info (see text)
6968c2ecf20Sopenharmony_ci pagetypeinfo Additional page allocator information (see text)  (2.5)
6978c2ecf20Sopenharmony_ci partitions   Table of partitions known to the system
6988c2ecf20Sopenharmony_ci pci 	      Deprecated info of PCI bus (new way -> /proc/bus/pci/,
6998c2ecf20Sopenharmony_ci              decoupled by lspci				(2.4)
7008c2ecf20Sopenharmony_ci rtc          Real time clock
7018c2ecf20Sopenharmony_ci scsi         SCSI info (see text)
7028c2ecf20Sopenharmony_ci slabinfo     Slab pool info
7038c2ecf20Sopenharmony_ci softirqs     softirq usage
7048c2ecf20Sopenharmony_ci stat         Overall statistics
7058c2ecf20Sopenharmony_ci swaps        Swap space utilization
7068c2ecf20Sopenharmony_ci sys          See chapter 2
7078c2ecf20Sopenharmony_ci sysvipc      Info of SysVIPC Resources (msg, sem, shm)		(2.4)
7088c2ecf20Sopenharmony_ci tty 	      Info of tty drivers
7098c2ecf20Sopenharmony_ci uptime       Wall clock since boot, combined idle time of all cpus
7108c2ecf20Sopenharmony_ci version      Kernel version
7118c2ecf20Sopenharmony_ci video 	      bttv info of video resources			(2.4)
7128c2ecf20Sopenharmony_ci vmallocinfo  Show vmalloced areas
7138c2ecf20Sopenharmony_ci ============ ===============================================================
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ciYou can,  for  example,  check  which interrupts are currently in use and what
7168c2ecf20Sopenharmony_cithey are used for by looking in the file /proc/interrupts::
7178c2ecf20Sopenharmony_ci
7188c2ecf20Sopenharmony_ci  > cat /proc/interrupts
7198c2ecf20Sopenharmony_ci             CPU0
7208c2ecf20Sopenharmony_ci    0:    8728810          XT-PIC  timer
7218c2ecf20Sopenharmony_ci    1:        895          XT-PIC  keyboard
7228c2ecf20Sopenharmony_ci    2:          0          XT-PIC  cascade
7238c2ecf20Sopenharmony_ci    3:     531695          XT-PIC  aha152x
7248c2ecf20Sopenharmony_ci    4:    2014133          XT-PIC  serial
7258c2ecf20Sopenharmony_ci    5:      44401          XT-PIC  pcnet_cs
7268c2ecf20Sopenharmony_ci    8:          2          XT-PIC  rtc
7278c2ecf20Sopenharmony_ci   11:          8          XT-PIC  i82365
7288c2ecf20Sopenharmony_ci   12:     182918          XT-PIC  PS/2 Mouse
7298c2ecf20Sopenharmony_ci   13:          1          XT-PIC  fpu
7308c2ecf20Sopenharmony_ci   14:    1232265          XT-PIC  ide0
7318c2ecf20Sopenharmony_ci   15:          7          XT-PIC  ide1
7328c2ecf20Sopenharmony_ci  NMI:          0
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ciIn 2.4.* a couple of lines where added to this file LOC & ERR (this time is the
7358c2ecf20Sopenharmony_cioutput of a SMP machine)::
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci  > cat /proc/interrupts
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci             CPU0       CPU1
7408c2ecf20Sopenharmony_ci    0:    1243498    1214548    IO-APIC-edge  timer
7418c2ecf20Sopenharmony_ci    1:       8949       8958    IO-APIC-edge  keyboard
7428c2ecf20Sopenharmony_ci    2:          0          0          XT-PIC  cascade
7438c2ecf20Sopenharmony_ci    5:      11286      10161    IO-APIC-edge  soundblaster
7448c2ecf20Sopenharmony_ci    8:          1          0    IO-APIC-edge  rtc
7458c2ecf20Sopenharmony_ci    9:      27422      27407    IO-APIC-edge  3c503
7468c2ecf20Sopenharmony_ci   12:     113645     113873    IO-APIC-edge  PS/2 Mouse
7478c2ecf20Sopenharmony_ci   13:          0          0          XT-PIC  fpu
7488c2ecf20Sopenharmony_ci   14:      22491      24012    IO-APIC-edge  ide0
7498c2ecf20Sopenharmony_ci   15:       2183       2415    IO-APIC-edge  ide1
7508c2ecf20Sopenharmony_ci   17:      30564      30414   IO-APIC-level  eth0
7518c2ecf20Sopenharmony_ci   18:        177        164   IO-APIC-level  bttv
7528c2ecf20Sopenharmony_ci  NMI:    2457961    2457959
7538c2ecf20Sopenharmony_ci  LOC:    2457882    2457881
7548c2ecf20Sopenharmony_ci  ERR:       2155
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_ciNMI is incremented in this case because every timer interrupt generates a NMI
7578c2ecf20Sopenharmony_ci(Non Maskable Interrupt) which is used by the NMI Watchdog to detect lockups.
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_ciLOC is the local interrupt counter of the internal APIC of every CPU.
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ciERR is incremented in the case of errors in the IO-APIC bus (the bus that
7628c2ecf20Sopenharmony_ciconnects the CPUs in a SMP system. This means that an error has been detected,
7638c2ecf20Sopenharmony_cithe IO-APIC automatically retry the transmission, so it should not be a big
7648c2ecf20Sopenharmony_ciproblem, but you should read the SMP-FAQ.
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ciIn 2.6.2* /proc/interrupts was expanded again.  This time the goal was for
7678c2ecf20Sopenharmony_ci/proc/interrupts to display every IRQ vector in use by the system, not
7688c2ecf20Sopenharmony_cijust those considered 'most important'.  The new vectors are:
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_ciTHR
7718c2ecf20Sopenharmony_ci  interrupt raised when a machine check threshold counter
7728c2ecf20Sopenharmony_ci  (typically counting ECC corrected errors of memory or cache) exceeds
7738c2ecf20Sopenharmony_ci  a configurable threshold.  Only available on some systems.
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ciTRM
7768c2ecf20Sopenharmony_ci  a thermal event interrupt occurs when a temperature threshold
7778c2ecf20Sopenharmony_ci  has been exceeded for the CPU.  This interrupt may also be generated
7788c2ecf20Sopenharmony_ci  when the temperature drops back to normal.
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_ciSPU
7818c2ecf20Sopenharmony_ci  a spurious interrupt is some interrupt that was raised then lowered
7828c2ecf20Sopenharmony_ci  by some IO device before it could be fully processed by the APIC.  Hence
7838c2ecf20Sopenharmony_ci  the APIC sees the interrupt but does not know what device it came from.
7848c2ecf20Sopenharmony_ci  For this case the APIC will generate the interrupt with a IRQ vector
7858c2ecf20Sopenharmony_ci  of 0xff. This might also be generated by chipset bugs.
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ciRES, CAL, TLB
7888c2ecf20Sopenharmony_ci  rescheduling, call and TLB flush interrupts are
7898c2ecf20Sopenharmony_ci  sent from one CPU to another per the needs of the OS.  Typically,
7908c2ecf20Sopenharmony_ci  their statistics are used by kernel developers and interested users to
7918c2ecf20Sopenharmony_ci  determine the occurrence of interrupts of the given type.
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ciThe above IRQ vectors are displayed only when relevant.  For example,
7948c2ecf20Sopenharmony_cithe threshold vector does not exist on x86_64 platforms.  Others are
7958c2ecf20Sopenharmony_cisuppressed when the system is a uniprocessor.  As of this writing, only
7968c2ecf20Sopenharmony_cii386 and x86_64 platforms support the new IRQ vector displays.
7978c2ecf20Sopenharmony_ci
7988c2ecf20Sopenharmony_ciOf some interest is the introduction of the /proc/irq directory to 2.4.
7998c2ecf20Sopenharmony_ciIt could be used to set IRQ to CPU affinity. This means that you can "hook" an
8008c2ecf20Sopenharmony_ciIRQ to only one CPU, or to exclude a CPU of handling IRQs. The contents of the
8018c2ecf20Sopenharmony_ciirq subdir is one subdir for each IRQ, and two files; default_smp_affinity and
8028c2ecf20Sopenharmony_ciprof_cpu_mask.
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ciFor example::
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_ci  > ls /proc/irq/
8078c2ecf20Sopenharmony_ci  0  10  12  14  16  18  2  4  6  8  prof_cpu_mask
8088c2ecf20Sopenharmony_ci  1  11  13  15  17  19  3  5  7  9  default_smp_affinity
8098c2ecf20Sopenharmony_ci  > ls /proc/irq/0/
8108c2ecf20Sopenharmony_ci  smp_affinity
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_cismp_affinity is a bitmask, in which you can specify which CPUs can handle the
8138c2ecf20Sopenharmony_ciIRQ. You can set it by doing::
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci  > echo 1 > /proc/irq/10/smp_affinity
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ciThis means that only the first CPU will handle the IRQ, but you can also echo
8188c2ecf20Sopenharmony_ci5 which means that only the first and third CPU can handle the IRQ.
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ciThe contents of each smp_affinity file is the same by default::
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci  > cat /proc/irq/0/smp_affinity
8238c2ecf20Sopenharmony_ci  ffffffff
8248c2ecf20Sopenharmony_ci
8258c2ecf20Sopenharmony_ciThere is an alternate interface, smp_affinity_list which allows specifying
8268c2ecf20Sopenharmony_cia CPU range instead of a bitmask::
8278c2ecf20Sopenharmony_ci
8288c2ecf20Sopenharmony_ci  > cat /proc/irq/0/smp_affinity_list
8298c2ecf20Sopenharmony_ci  1024-1031
8308c2ecf20Sopenharmony_ci
8318c2ecf20Sopenharmony_ciThe default_smp_affinity mask applies to all non-active IRQs, which are the
8328c2ecf20Sopenharmony_ciIRQs which have not yet been allocated/activated, and hence which lack a
8338c2ecf20Sopenharmony_ci/proc/irq/[0-9]* directory.
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ciThe node file on an SMP system shows the node to which the device using the IRQ
8368c2ecf20Sopenharmony_cireports itself as being attached. This hardware locality information does not
8378c2ecf20Sopenharmony_ciinclude information about any possible driver locality preference.
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ciprof_cpu_mask specifies which CPUs are to be profiled by the system wide
8408c2ecf20Sopenharmony_ciprofiler. Default value is ffffffff (all CPUs if there are only 32 of them).
8418c2ecf20Sopenharmony_ci
8428c2ecf20Sopenharmony_ciThe way IRQs are routed is handled by the IO-APIC, and it's Round Robin
8438c2ecf20Sopenharmony_cibetween all the CPUs which are allowed to handle it. As usual the kernel has
8448c2ecf20Sopenharmony_cimore info than you and does a better job than you, so the defaults are the
8458c2ecf20Sopenharmony_cibest choice for almost everyone.  [Note this applies only to those IO-APIC's
8468c2ecf20Sopenharmony_cithat support "Round Robin" interrupt distribution.]
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ciThere are  three  more  important subdirectories in /proc: net, scsi, and sys.
8498c2ecf20Sopenharmony_ciThe general  rule  is  that  the  contents,  or  even  the  existence of these
8508c2ecf20Sopenharmony_cidirectories, depend  on your kernel configuration. If SCSI is not enabled, the
8518c2ecf20Sopenharmony_cidirectory scsi  may  not  exist. The same is true with the net, which is there
8528c2ecf20Sopenharmony_cionly when networking support is present in the running kernel.
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_ciThe slabinfo  file  gives  information  about  memory usage at the slab level.
8558c2ecf20Sopenharmony_ciLinux uses  slab  pools for memory management above page level in version 2.2.
8568c2ecf20Sopenharmony_ciCommonly used  objects  have  their  own  slab  pool (such as network buffers,
8578c2ecf20Sopenharmony_cidirectory cache, and so on).
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_ci::
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci    > cat /proc/buddyinfo
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci    Node 0, zone      DMA      0      4      5      4      4      3 ...
8648c2ecf20Sopenharmony_ci    Node 0, zone   Normal      1      0      0      1    101      8 ...
8658c2ecf20Sopenharmony_ci    Node 0, zone  HighMem      2      0      0      1      1      0 ...
8668c2ecf20Sopenharmony_ci
8678c2ecf20Sopenharmony_ciExternal fragmentation is a problem under some workloads, and buddyinfo is a
8688c2ecf20Sopenharmony_ciuseful tool for helping diagnose these problems.  Buddyinfo will give you a
8698c2ecf20Sopenharmony_ciclue as to how big an area you can safely allocate, or why a previous
8708c2ecf20Sopenharmony_ciallocation failed.
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ciEach column represents the number of pages of a certain order which are
8738c2ecf20Sopenharmony_ciavailable.  In this case, there are 0 chunks of 2^0*PAGE_SIZE available in
8748c2ecf20Sopenharmony_ciZONE_DMA, 4 chunks of 2^1*PAGE_SIZE in ZONE_DMA, 101 chunks of 2^4*PAGE_SIZE
8758c2ecf20Sopenharmony_ciavailable in ZONE_NORMAL, etc...
8768c2ecf20Sopenharmony_ci
8778c2ecf20Sopenharmony_ciMore information relevant to external fragmentation can be found in
8788c2ecf20Sopenharmony_cipagetypeinfo::
8798c2ecf20Sopenharmony_ci
8808c2ecf20Sopenharmony_ci    > cat /proc/pagetypeinfo
8818c2ecf20Sopenharmony_ci    Page block order: 9
8828c2ecf20Sopenharmony_ci    Pages per block:  512
8838c2ecf20Sopenharmony_ci
8848c2ecf20Sopenharmony_ci    Free pages count per migrate type at order       0      1      2      3      4      5      6      7      8      9     10
8858c2ecf20Sopenharmony_ci    Node    0, zone      DMA, type    Unmovable      0      0      0      1      1      1      1      1      1      1      0
8868c2ecf20Sopenharmony_ci    Node    0, zone      DMA, type  Reclaimable      0      0      0      0      0      0      0      0      0      0      0
8878c2ecf20Sopenharmony_ci    Node    0, zone      DMA, type      Movable      1      1      2      1      2      1      1      0      1      0      2
8888c2ecf20Sopenharmony_ci    Node    0, zone      DMA, type      Reserve      0      0      0      0      0      0      0      0      0      1      0
8898c2ecf20Sopenharmony_ci    Node    0, zone      DMA, type      Isolate      0      0      0      0      0      0      0      0      0      0      0
8908c2ecf20Sopenharmony_ci    Node    0, zone    DMA32, type    Unmovable    103     54     77      1      1      1     11      8      7      1      9
8918c2ecf20Sopenharmony_ci    Node    0, zone    DMA32, type  Reclaimable      0      0      2      1      0      0      0      0      1      0      0
8928c2ecf20Sopenharmony_ci    Node    0, zone    DMA32, type      Movable    169    152    113     91     77     54     39     13      6      1    452
8938c2ecf20Sopenharmony_ci    Node    0, zone    DMA32, type      Reserve      1      2      2      2      2      0      1      1      1      1      0
8948c2ecf20Sopenharmony_ci    Node    0, zone    DMA32, type      Isolate      0      0      0      0      0      0      0      0      0      0      0
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci    Number of blocks type     Unmovable  Reclaimable      Movable      Reserve      Isolate
8978c2ecf20Sopenharmony_ci    Node 0, zone      DMA            2            0            5            1            0
8988c2ecf20Sopenharmony_ci    Node 0, zone    DMA32           41            6          967            2            0
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ciFragmentation avoidance in the kernel works by grouping pages of different
9018c2ecf20Sopenharmony_cimigrate types into the same contiguous regions of memory called page blocks.
9028c2ecf20Sopenharmony_ciA page block is typically the size of the default hugepage size, e.g. 2MB on
9038c2ecf20Sopenharmony_ciX86-64. By keeping pages grouped based on their ability to move, the kernel
9048c2ecf20Sopenharmony_cican reclaim pages within a page block to satisfy a high-order allocation.
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ciThe pagetypinfo begins with information on the size of a page block. It
9078c2ecf20Sopenharmony_cithen gives the same type of information as buddyinfo except broken down
9088c2ecf20Sopenharmony_ciby migrate-type and finishes with details on how many page blocks of each
9098c2ecf20Sopenharmony_citype exist.
9108c2ecf20Sopenharmony_ci
9118c2ecf20Sopenharmony_ciIf min_free_kbytes has been tuned correctly (recommendations made by hugeadm
9128c2ecf20Sopenharmony_cifrom libhugetlbfs https://github.com/libhugetlbfs/libhugetlbfs/), one can
9138c2ecf20Sopenharmony_cimake an estimate of the likely number of huge pages that can be allocated
9148c2ecf20Sopenharmony_ciat a given point in time. All the "Movable" blocks should be allocatable
9158c2ecf20Sopenharmony_ciunless memory has been mlock()'d. Some of the Reclaimable blocks should
9168c2ecf20Sopenharmony_cialso be allocatable although a lot of filesystem metadata may have to be
9178c2ecf20Sopenharmony_cireclaimed to achieve this.
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_cimeminfo
9218c2ecf20Sopenharmony_ci~~~~~~~
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ciProvides information about distribution and utilization of memory.  This
9248c2ecf20Sopenharmony_civaries by architecture and compile options.  The following is from a
9258c2ecf20Sopenharmony_ci16GB PIII, which has highmem enabled.  You may not have all of these fields.
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci::
9288c2ecf20Sopenharmony_ci
9298c2ecf20Sopenharmony_ci    > cat /proc/meminfo
9308c2ecf20Sopenharmony_ci
9318c2ecf20Sopenharmony_ci    MemTotal:     16344972 kB
9328c2ecf20Sopenharmony_ci    MemFree:      13634064 kB
9338c2ecf20Sopenharmony_ci    MemAvailable: 14836172 kB
9348c2ecf20Sopenharmony_ci    Buffers:          3656 kB
9358c2ecf20Sopenharmony_ci    Cached:        1195708 kB
9368c2ecf20Sopenharmony_ci    SwapCached:          0 kB
9378c2ecf20Sopenharmony_ci    Active:         891636 kB
9388c2ecf20Sopenharmony_ci    Inactive:      1077224 kB
9398c2ecf20Sopenharmony_ci    HighTotal:    15597528 kB
9408c2ecf20Sopenharmony_ci    HighFree:     13629632 kB
9418c2ecf20Sopenharmony_ci    LowTotal:       747444 kB
9428c2ecf20Sopenharmony_ci    LowFree:          4432 kB
9438c2ecf20Sopenharmony_ci    SwapTotal:           0 kB
9448c2ecf20Sopenharmony_ci    SwapFree:            0 kB
9458c2ecf20Sopenharmony_ci    Dirty:             968 kB
9468c2ecf20Sopenharmony_ci    Writeback:           0 kB
9478c2ecf20Sopenharmony_ci    AnonPages:      861800 kB
9488c2ecf20Sopenharmony_ci    Mapped:         280372 kB
9498c2ecf20Sopenharmony_ci    Shmem:             644 kB
9508c2ecf20Sopenharmony_ci    KReclaimable:   168048 kB
9518c2ecf20Sopenharmony_ci    Slab:           284364 kB
9528c2ecf20Sopenharmony_ci    SReclaimable:   159856 kB
9538c2ecf20Sopenharmony_ci    SUnreclaim:     124508 kB
9548c2ecf20Sopenharmony_ci    PageTables:      24448 kB
9558c2ecf20Sopenharmony_ci    NFS_Unstable:        0 kB
9568c2ecf20Sopenharmony_ci    Bounce:              0 kB
9578c2ecf20Sopenharmony_ci    WritebackTmp:        0 kB
9588c2ecf20Sopenharmony_ci    CommitLimit:   7669796 kB
9598c2ecf20Sopenharmony_ci    Committed_AS:   100056 kB
9608c2ecf20Sopenharmony_ci    VmallocTotal:   112216 kB
9618c2ecf20Sopenharmony_ci    VmallocUsed:       428 kB
9628c2ecf20Sopenharmony_ci    VmallocChunk:   111088 kB
9638c2ecf20Sopenharmony_ci    Percpu:          62080 kB
9648c2ecf20Sopenharmony_ci    HardwareCorrupted:   0 kB
9658c2ecf20Sopenharmony_ci    AnonHugePages:   49152 kB
9668c2ecf20Sopenharmony_ci    ShmemHugePages:      0 kB
9678c2ecf20Sopenharmony_ci    ShmemPmdMapped:      0 kB
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ciMemTotal
9708c2ecf20Sopenharmony_ci              Total usable RAM (i.e. physical RAM minus a few reserved
9718c2ecf20Sopenharmony_ci              bits and the kernel binary code)
9728c2ecf20Sopenharmony_ciMemFree
9738c2ecf20Sopenharmony_ci              The sum of LowFree+HighFree
9748c2ecf20Sopenharmony_ciMemAvailable
9758c2ecf20Sopenharmony_ci              An estimate of how much memory is available for starting new
9768c2ecf20Sopenharmony_ci              applications, without swapping. Calculated from MemFree,
9778c2ecf20Sopenharmony_ci              SReclaimable, the size of the file LRU lists, and the low
9788c2ecf20Sopenharmony_ci              watermarks in each zone.
9798c2ecf20Sopenharmony_ci              The estimate takes into account that the system needs some
9808c2ecf20Sopenharmony_ci              page cache to function well, and that not all reclaimable
9818c2ecf20Sopenharmony_ci              slab will be reclaimable, due to items being in use. The
9828c2ecf20Sopenharmony_ci              impact of those factors will vary from system to system.
9838c2ecf20Sopenharmony_ciBuffers
9848c2ecf20Sopenharmony_ci              Relatively temporary storage for raw disk blocks
9858c2ecf20Sopenharmony_ci              shouldn't get tremendously large (20MB or so)
9868c2ecf20Sopenharmony_ciCached
9878c2ecf20Sopenharmony_ci              in-memory cache for files read from the disk (the
9888c2ecf20Sopenharmony_ci              pagecache).  Doesn't include SwapCached
9898c2ecf20Sopenharmony_ciSwapCached
9908c2ecf20Sopenharmony_ci              Memory that once was swapped out, is swapped back in but
9918c2ecf20Sopenharmony_ci              still also is in the swapfile (if memory is needed it
9928c2ecf20Sopenharmony_ci              doesn't need to be swapped out AGAIN because it is already
9938c2ecf20Sopenharmony_ci              in the swapfile. This saves I/O)
9948c2ecf20Sopenharmony_ciActive
9958c2ecf20Sopenharmony_ci              Memory that has been used more recently and usually not
9968c2ecf20Sopenharmony_ci              reclaimed unless absolutely necessary.
9978c2ecf20Sopenharmony_ciInactive
9988c2ecf20Sopenharmony_ci              Memory which has been less recently used.  It is more
9998c2ecf20Sopenharmony_ci              eligible to be reclaimed for other purposes
10008c2ecf20Sopenharmony_ciHighTotal, HighFree
10018c2ecf20Sopenharmony_ci              Highmem is all memory above ~860MB of physical memory.
10028c2ecf20Sopenharmony_ci              Highmem areas are for use by userspace programs, or
10038c2ecf20Sopenharmony_ci              for the pagecache.  The kernel must use tricks to access
10048c2ecf20Sopenharmony_ci              this memory, making it slower to access than lowmem.
10058c2ecf20Sopenharmony_ciLowTotal, LowFree
10068c2ecf20Sopenharmony_ci              Lowmem is memory which can be used for everything that
10078c2ecf20Sopenharmony_ci              highmem can be used for, but it is also available for the
10088c2ecf20Sopenharmony_ci              kernel's use for its own data structures.  Among many
10098c2ecf20Sopenharmony_ci              other things, it is where everything from the Slab is
10108c2ecf20Sopenharmony_ci              allocated.  Bad things happen when you're out of lowmem.
10118c2ecf20Sopenharmony_ciSwapTotal
10128c2ecf20Sopenharmony_ci              total amount of swap space available
10138c2ecf20Sopenharmony_ciSwapFree
10148c2ecf20Sopenharmony_ci              Memory which has been evicted from RAM, and is temporarily
10158c2ecf20Sopenharmony_ci              on the disk
10168c2ecf20Sopenharmony_ciDirty
10178c2ecf20Sopenharmony_ci              Memory which is waiting to get written back to the disk
10188c2ecf20Sopenharmony_ciWriteback
10198c2ecf20Sopenharmony_ci              Memory which is actively being written back to the disk
10208c2ecf20Sopenharmony_ciAnonPages
10218c2ecf20Sopenharmony_ci              Non-file backed pages mapped into userspace page tables
10228c2ecf20Sopenharmony_ciHardwareCorrupted
10238c2ecf20Sopenharmony_ci              The amount of RAM/memory in KB, the kernel identifies as
10248c2ecf20Sopenharmony_ci	      corrupted.
10258c2ecf20Sopenharmony_ciAnonHugePages
10268c2ecf20Sopenharmony_ci              Non-file backed huge pages mapped into userspace page tables
10278c2ecf20Sopenharmony_ciMapped
10288c2ecf20Sopenharmony_ci              files which have been mmaped, such as libraries
10298c2ecf20Sopenharmony_ciShmem
10308c2ecf20Sopenharmony_ci              Total memory used by shared memory (shmem) and tmpfs
10318c2ecf20Sopenharmony_ciShmemHugePages
10328c2ecf20Sopenharmony_ci              Memory used by shared memory (shmem) and tmpfs allocated
10338c2ecf20Sopenharmony_ci              with huge pages
10348c2ecf20Sopenharmony_ciShmemPmdMapped
10358c2ecf20Sopenharmony_ci              Shared memory mapped into userspace with huge pages
10368c2ecf20Sopenharmony_ciKReclaimable
10378c2ecf20Sopenharmony_ci              Kernel allocations that the kernel will attempt to reclaim
10388c2ecf20Sopenharmony_ci              under memory pressure. Includes SReclaimable (below), and other
10398c2ecf20Sopenharmony_ci              direct allocations with a shrinker.
10408c2ecf20Sopenharmony_ciSlab
10418c2ecf20Sopenharmony_ci              in-kernel data structures cache
10428c2ecf20Sopenharmony_ciSReclaimable
10438c2ecf20Sopenharmony_ci              Part of Slab, that might be reclaimed, such as caches
10448c2ecf20Sopenharmony_ciSUnreclaim
10458c2ecf20Sopenharmony_ci              Part of Slab, that cannot be reclaimed on memory pressure
10468c2ecf20Sopenharmony_ciPageTables
10478c2ecf20Sopenharmony_ci              amount of memory dedicated to the lowest level of page
10488c2ecf20Sopenharmony_ci              tables.
10498c2ecf20Sopenharmony_ciNFS_Unstable
10508c2ecf20Sopenharmony_ci              Always zero. Previous counted pages which had been written to
10518c2ecf20Sopenharmony_ci              the server, but has not been committed to stable storage.
10528c2ecf20Sopenharmony_ciBounce
10538c2ecf20Sopenharmony_ci              Memory used for block device "bounce buffers"
10548c2ecf20Sopenharmony_ciWritebackTmp
10558c2ecf20Sopenharmony_ci              Memory used by FUSE for temporary writeback buffers
10568c2ecf20Sopenharmony_ciCommitLimit
10578c2ecf20Sopenharmony_ci              Based on the overcommit ratio ('vm.overcommit_ratio'),
10588c2ecf20Sopenharmony_ci              this is the total amount of  memory currently available to
10598c2ecf20Sopenharmony_ci              be allocated on the system. This limit is only adhered to
10608c2ecf20Sopenharmony_ci              if strict overcommit accounting is enabled (mode 2 in
10618c2ecf20Sopenharmony_ci              'vm.overcommit_memory').
10628c2ecf20Sopenharmony_ci
10638c2ecf20Sopenharmony_ci              The CommitLimit is calculated with the following formula::
10648c2ecf20Sopenharmony_ci
10658c2ecf20Sopenharmony_ci                CommitLimit = ([total RAM pages] - [total huge TLB pages]) *
10668c2ecf20Sopenharmony_ci                               overcommit_ratio / 100 + [total swap pages]
10678c2ecf20Sopenharmony_ci
10688c2ecf20Sopenharmony_ci              For example, on a system with 1G of physical RAM and 7G
10698c2ecf20Sopenharmony_ci              of swap with a `vm.overcommit_ratio` of 30 it would
10708c2ecf20Sopenharmony_ci              yield a CommitLimit of 7.3G.
10718c2ecf20Sopenharmony_ci
10728c2ecf20Sopenharmony_ci              For more details, see the memory overcommit documentation
10738c2ecf20Sopenharmony_ci              in vm/overcommit-accounting.
10748c2ecf20Sopenharmony_ciCommitted_AS
10758c2ecf20Sopenharmony_ci              The amount of memory presently allocated on the system.
10768c2ecf20Sopenharmony_ci              The committed memory is a sum of all of the memory which
10778c2ecf20Sopenharmony_ci              has been allocated by processes, even if it has not been
10788c2ecf20Sopenharmony_ci              "used" by them as of yet. A process which malloc()'s 1G
10798c2ecf20Sopenharmony_ci              of memory, but only touches 300M of it will show up as
10808c2ecf20Sopenharmony_ci	      using 1G. This 1G is memory which has been "committed" to
10818c2ecf20Sopenharmony_ci              by the VM and can be used at any time by the allocating
10828c2ecf20Sopenharmony_ci              application. With strict overcommit enabled on the system
10838c2ecf20Sopenharmony_ci              (mode 2 in 'vm.overcommit_memory'), allocations which would
10848c2ecf20Sopenharmony_ci              exceed the CommitLimit (detailed above) will not be permitted.
10858c2ecf20Sopenharmony_ci              This is useful if one needs to guarantee that processes will
10868c2ecf20Sopenharmony_ci              not fail due to lack of memory once that memory has been
10878c2ecf20Sopenharmony_ci              successfully allocated.
10888c2ecf20Sopenharmony_ciVmallocTotal
10898c2ecf20Sopenharmony_ci              total size of vmalloc memory area
10908c2ecf20Sopenharmony_ciVmallocUsed
10918c2ecf20Sopenharmony_ci              amount of vmalloc area which is used
10928c2ecf20Sopenharmony_ciVmallocChunk
10938c2ecf20Sopenharmony_ci              largest contiguous block of vmalloc area which is free
10948c2ecf20Sopenharmony_ciPercpu
10958c2ecf20Sopenharmony_ci              Memory allocated to the percpu allocator used to back percpu
10968c2ecf20Sopenharmony_ci              allocations. This stat excludes the cost of metadata.
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_civmallocinfo
10998c2ecf20Sopenharmony_ci~~~~~~~~~~~
11008c2ecf20Sopenharmony_ci
11018c2ecf20Sopenharmony_ciProvides information about vmalloced/vmaped areas. One line per area,
11028c2ecf20Sopenharmony_cicontaining the virtual address range of the area, size in bytes,
11038c2ecf20Sopenharmony_cicaller information of the creator, and optional information depending
11048c2ecf20Sopenharmony_cion the kind of area:
11058c2ecf20Sopenharmony_ci
11068c2ecf20Sopenharmony_ci ==========  ===================================================
11078c2ecf20Sopenharmony_ci pages=nr    number of pages
11088c2ecf20Sopenharmony_ci phys=addr   if a physical address was specified
11098c2ecf20Sopenharmony_ci ioremap     I/O mapping (ioremap() and friends)
11108c2ecf20Sopenharmony_ci vmalloc     vmalloc() area
11118c2ecf20Sopenharmony_ci vmap        vmap()ed pages
11128c2ecf20Sopenharmony_ci user        VM_USERMAP area
11138c2ecf20Sopenharmony_ci vpages      buffer for pages pointers was vmalloced (huge area)
11148c2ecf20Sopenharmony_ci N<node>=nr  (Only on NUMA kernels)
11158c2ecf20Sopenharmony_ci             Number of pages allocated on memory node <node>
11168c2ecf20Sopenharmony_ci ==========  ===================================================
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_ci::
11198c2ecf20Sopenharmony_ci
11208c2ecf20Sopenharmony_ci    > cat /proc/vmallocinfo
11218c2ecf20Sopenharmony_ci    0xffffc20000000000-0xffffc20000201000 2101248 alloc_large_system_hash+0x204 ...
11228c2ecf20Sopenharmony_ci    /0x2c0 pages=512 vmalloc N0=128 N1=128 N2=128 N3=128
11238c2ecf20Sopenharmony_ci    0xffffc20000201000-0xffffc20000302000 1052672 alloc_large_system_hash+0x204 ...
11248c2ecf20Sopenharmony_ci    /0x2c0 pages=256 vmalloc N0=64 N1=64 N2=64 N3=64
11258c2ecf20Sopenharmony_ci    0xffffc20000302000-0xffffc20000304000    8192 acpi_tb_verify_table+0x21/0x4f...
11268c2ecf20Sopenharmony_ci    phys=7fee8000 ioremap
11278c2ecf20Sopenharmony_ci    0xffffc20000304000-0xffffc20000307000   12288 acpi_tb_verify_table+0x21/0x4f...
11288c2ecf20Sopenharmony_ci    phys=7fee7000 ioremap
11298c2ecf20Sopenharmony_ci    0xffffc2000031d000-0xffffc2000031f000    8192 init_vdso_vars+0x112/0x210
11308c2ecf20Sopenharmony_ci    0xffffc2000031f000-0xffffc2000032b000   49152 cramfs_uncompress_init+0x2e ...
11318c2ecf20Sopenharmony_ci    /0x80 pages=11 vmalloc N0=3 N1=3 N2=2 N3=3
11328c2ecf20Sopenharmony_ci    0xffffc2000033a000-0xffffc2000033d000   12288 sys_swapon+0x640/0xac0      ...
11338c2ecf20Sopenharmony_ci    pages=2 vmalloc N1=2
11348c2ecf20Sopenharmony_ci    0xffffc20000347000-0xffffc2000034c000   20480 xt_alloc_table_info+0xfe ...
11358c2ecf20Sopenharmony_ci    /0x130 [x_tables] pages=4 vmalloc N0=4
11368c2ecf20Sopenharmony_ci    0xffffffffa0000000-0xffffffffa000f000   61440 sys_init_module+0xc27/0x1d00 ...
11378c2ecf20Sopenharmony_ci    pages=14 vmalloc N2=14
11388c2ecf20Sopenharmony_ci    0xffffffffa000f000-0xffffffffa0014000   20480 sys_init_module+0xc27/0x1d00 ...
11398c2ecf20Sopenharmony_ci    pages=4 vmalloc N1=4
11408c2ecf20Sopenharmony_ci    0xffffffffa0014000-0xffffffffa0017000   12288 sys_init_module+0xc27/0x1d00 ...
11418c2ecf20Sopenharmony_ci    pages=2 vmalloc N1=2
11428c2ecf20Sopenharmony_ci    0xffffffffa0017000-0xffffffffa0022000   45056 sys_init_module+0xc27/0x1d00 ...
11438c2ecf20Sopenharmony_ci    pages=10 vmalloc N0=10
11448c2ecf20Sopenharmony_ci
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_cisoftirqs
11478c2ecf20Sopenharmony_ci~~~~~~~~
11488c2ecf20Sopenharmony_ci
11498c2ecf20Sopenharmony_ciProvides counts of softirq handlers serviced since boot time, for each CPU.
11508c2ecf20Sopenharmony_ci
11518c2ecf20Sopenharmony_ci::
11528c2ecf20Sopenharmony_ci
11538c2ecf20Sopenharmony_ci    > cat /proc/softirqs
11548c2ecf20Sopenharmony_ci		  CPU0       CPU1       CPU2       CPU3
11558c2ecf20Sopenharmony_ci	HI:          0          0          0          0
11568c2ecf20Sopenharmony_ci    TIMER:       27166      27120      27097      27034
11578c2ecf20Sopenharmony_ci    NET_TX:          0          0          0         17
11588c2ecf20Sopenharmony_ci    NET_RX:         42          0          0         39
11598c2ecf20Sopenharmony_ci    BLOCK:           0          0        107       1121
11608c2ecf20Sopenharmony_ci    TASKLET:         0          0          0        290
11618c2ecf20Sopenharmony_ci    SCHED:       27035      26983      26971      26746
11628c2ecf20Sopenharmony_ci    HRTIMER:         0          0          0          0
11638c2ecf20Sopenharmony_ci	RCU:      1678       1769       2178       2250
11648c2ecf20Sopenharmony_ci
11658c2ecf20Sopenharmony_ci
11668c2ecf20Sopenharmony_ci1.3 IDE devices in /proc/ide
11678c2ecf20Sopenharmony_ci----------------------------
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ciThe subdirectory /proc/ide contains information about all IDE devices of which
11708c2ecf20Sopenharmony_cithe kernel  is  aware.  There is one subdirectory for each IDE controller, the
11718c2ecf20Sopenharmony_cifile drivers  and a link for each IDE device, pointing to the device directory
11728c2ecf20Sopenharmony_ciin the controller specific subtree.
11738c2ecf20Sopenharmony_ci
11748c2ecf20Sopenharmony_ciThe file 'drivers' contains general information about the drivers used for the
11758c2ecf20Sopenharmony_ciIDE devices::
11768c2ecf20Sopenharmony_ci
11778c2ecf20Sopenharmony_ci  > cat /proc/ide/drivers
11788c2ecf20Sopenharmony_ci  ide-cdrom version 4.53
11798c2ecf20Sopenharmony_ci  ide-disk version 1.08
11808c2ecf20Sopenharmony_ci
11818c2ecf20Sopenharmony_ciMore detailed  information  can  be  found  in  the  controller  specific
11828c2ecf20Sopenharmony_cisubdirectories. These  are  named  ide0,  ide1  and  so  on.  Each  of  these
11838c2ecf20Sopenharmony_cidirectories contains the files shown in table 1-6.
11848c2ecf20Sopenharmony_ci
11858c2ecf20Sopenharmony_ci
11868c2ecf20Sopenharmony_ci.. table:: Table 1-6: IDE controller info in  /proc/ide/ide?
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci ======= =======================================
11898c2ecf20Sopenharmony_ci File    Content
11908c2ecf20Sopenharmony_ci ======= =======================================
11918c2ecf20Sopenharmony_ci channel IDE channel (0 or 1)
11928c2ecf20Sopenharmony_ci config  Configuration (only for PCI/IDE bridge)
11938c2ecf20Sopenharmony_ci mate    Mate name
11948c2ecf20Sopenharmony_ci model   Type/Chipset of IDE controller
11958c2ecf20Sopenharmony_ci ======= =======================================
11968c2ecf20Sopenharmony_ci
11978c2ecf20Sopenharmony_ciEach device  connected  to  a  controller  has  a separate subdirectory in the
11988c2ecf20Sopenharmony_cicontrollers directory.  The  files  listed in table 1-7 are contained in these
11998c2ecf20Sopenharmony_cidirectories.
12008c2ecf20Sopenharmony_ci
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci.. table:: Table 1-7: IDE device information
12038c2ecf20Sopenharmony_ci
12048c2ecf20Sopenharmony_ci ================ ==========================================
12058c2ecf20Sopenharmony_ci File             Content
12068c2ecf20Sopenharmony_ci ================ ==========================================
12078c2ecf20Sopenharmony_ci cache            The cache
12088c2ecf20Sopenharmony_ci capacity         Capacity of the medium (in 512Byte blocks)
12098c2ecf20Sopenharmony_ci driver           driver and version
12108c2ecf20Sopenharmony_ci geometry         physical and logical geometry
12118c2ecf20Sopenharmony_ci identify         device identify block
12128c2ecf20Sopenharmony_ci media            media type
12138c2ecf20Sopenharmony_ci model            device identifier
12148c2ecf20Sopenharmony_ci settings         device setup
12158c2ecf20Sopenharmony_ci smart_thresholds IDE disk management thresholds
12168c2ecf20Sopenharmony_ci smart_values     IDE disk management values
12178c2ecf20Sopenharmony_ci ================ ==========================================
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ciThe most  interesting  file is ``settings``. This file contains a nice
12208c2ecf20Sopenharmony_cioverview of the drive parameters::
12218c2ecf20Sopenharmony_ci
12228c2ecf20Sopenharmony_ci  # cat /proc/ide/ide0/hda/settings
12238c2ecf20Sopenharmony_ci  name                    value           min             max             mode
12248c2ecf20Sopenharmony_ci  ----                    -----           ---             ---             ----
12258c2ecf20Sopenharmony_ci  bios_cyl                526             0               65535           rw
12268c2ecf20Sopenharmony_ci  bios_head               255             0               255             rw
12278c2ecf20Sopenharmony_ci  bios_sect               63              0               63              rw
12288c2ecf20Sopenharmony_ci  breada_readahead        4               0               127             rw
12298c2ecf20Sopenharmony_ci  bswap                   0               0               1               r
12308c2ecf20Sopenharmony_ci  file_readahead          72              0               2097151         rw
12318c2ecf20Sopenharmony_ci  io_32bit                0               0               3               rw
12328c2ecf20Sopenharmony_ci  keepsettings            0               0               1               rw
12338c2ecf20Sopenharmony_ci  max_kb_per_request      122             1               127             rw
12348c2ecf20Sopenharmony_ci  multcount               0               0               8               rw
12358c2ecf20Sopenharmony_ci  nice1                   1               0               1               rw
12368c2ecf20Sopenharmony_ci  nowerr                  0               0               1               rw
12378c2ecf20Sopenharmony_ci  pio_mode                write-only      0               255             w
12388c2ecf20Sopenharmony_ci  slow                    0               0               1               rw
12398c2ecf20Sopenharmony_ci  unmaskirq               0               0               1               rw
12408c2ecf20Sopenharmony_ci  using_dma               0               0               1               rw
12418c2ecf20Sopenharmony_ci
12428c2ecf20Sopenharmony_ci
12438c2ecf20Sopenharmony_ci1.4 Networking info in /proc/net
12448c2ecf20Sopenharmony_ci--------------------------------
12458c2ecf20Sopenharmony_ci
12468c2ecf20Sopenharmony_ciThe subdirectory  /proc/net  follows  the  usual  pattern. Table 1-8 shows the
12478c2ecf20Sopenharmony_ciadditional values  you  get  for  IP  version 6 if you configure the kernel to
12488c2ecf20Sopenharmony_cisupport this. Table 1-9 lists the files and their meaning.
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_ci
12518c2ecf20Sopenharmony_ci.. table:: Table 1-8: IPv6 info in /proc/net
12528c2ecf20Sopenharmony_ci
12538c2ecf20Sopenharmony_ci ========== =====================================================
12548c2ecf20Sopenharmony_ci File       Content
12558c2ecf20Sopenharmony_ci ========== =====================================================
12568c2ecf20Sopenharmony_ci udp6       UDP sockets (IPv6)
12578c2ecf20Sopenharmony_ci tcp6       TCP sockets (IPv6)
12588c2ecf20Sopenharmony_ci raw6       Raw device statistics (IPv6)
12598c2ecf20Sopenharmony_ci igmp6      IP multicast addresses, which this host joined (IPv6)
12608c2ecf20Sopenharmony_ci if_inet6   List of IPv6 interface addresses
12618c2ecf20Sopenharmony_ci ipv6_route Kernel routing table for IPv6
12628c2ecf20Sopenharmony_ci rt6_stats  Global IPv6 routing tables statistics
12638c2ecf20Sopenharmony_ci sockstat6  Socket statistics (IPv6)
12648c2ecf20Sopenharmony_ci snmp6      Snmp data (IPv6)
12658c2ecf20Sopenharmony_ci ========== =====================================================
12668c2ecf20Sopenharmony_ci
12678c2ecf20Sopenharmony_ci.. table:: Table 1-9: Network info in /proc/net
12688c2ecf20Sopenharmony_ci
12698c2ecf20Sopenharmony_ci ============= ================================================================
12708c2ecf20Sopenharmony_ci File          Content
12718c2ecf20Sopenharmony_ci ============= ================================================================
12728c2ecf20Sopenharmony_ci arp           Kernel  ARP table
12738c2ecf20Sopenharmony_ci dev           network devices with statistics
12748c2ecf20Sopenharmony_ci dev_mcast     the Layer2 multicast groups a device is listening too
12758c2ecf20Sopenharmony_ci               (interface index, label, number of references, number of bound
12768c2ecf20Sopenharmony_ci               addresses).
12778c2ecf20Sopenharmony_ci dev_stat      network device status
12788c2ecf20Sopenharmony_ci ip_fwchains   Firewall chain linkage
12798c2ecf20Sopenharmony_ci ip_fwnames    Firewall chain names
12808c2ecf20Sopenharmony_ci ip_masq       Directory containing the masquerading tables
12818c2ecf20Sopenharmony_ci ip_masquerade Major masquerading table
12828c2ecf20Sopenharmony_ci netstat       Network statistics
12838c2ecf20Sopenharmony_ci raw           raw device statistics
12848c2ecf20Sopenharmony_ci route         Kernel routing table
12858c2ecf20Sopenharmony_ci rpc           Directory containing rpc info
12868c2ecf20Sopenharmony_ci rt_cache      Routing cache
12878c2ecf20Sopenharmony_ci snmp          SNMP data
12888c2ecf20Sopenharmony_ci sockstat      Socket statistics
12898c2ecf20Sopenharmony_ci tcp           TCP  sockets
12908c2ecf20Sopenharmony_ci udp           UDP sockets
12918c2ecf20Sopenharmony_ci unix          UNIX domain sockets
12928c2ecf20Sopenharmony_ci wireless      Wireless interface data (Wavelan etc)
12938c2ecf20Sopenharmony_ci igmp          IP multicast addresses, which this host joined
12948c2ecf20Sopenharmony_ci psched        Global packet scheduler parameters.
12958c2ecf20Sopenharmony_ci netlink       List of PF_NETLINK sockets
12968c2ecf20Sopenharmony_ci ip_mr_vifs    List of multicast virtual interfaces
12978c2ecf20Sopenharmony_ci ip_mr_cache   List of multicast routing cache
12988c2ecf20Sopenharmony_ci ============= ================================================================
12998c2ecf20Sopenharmony_ci
13008c2ecf20Sopenharmony_ciYou can  use  this  information  to see which network devices are available in
13018c2ecf20Sopenharmony_ciyour system and how much traffic was routed over those devices::
13028c2ecf20Sopenharmony_ci
13038c2ecf20Sopenharmony_ci  > cat /proc/net/dev
13048c2ecf20Sopenharmony_ci  Inter-|Receive                                                   |[...
13058c2ecf20Sopenharmony_ci   face |bytes    packets errs drop fifo frame compressed multicast|[...
13068c2ecf20Sopenharmony_ci      lo:  908188   5596     0    0    0     0          0         0 [...
13078c2ecf20Sopenharmony_ci    ppp0:15475140  20721   410    0    0   410          0         0 [...
13088c2ecf20Sopenharmony_ci    eth0:  614530   7085     0    0    0     0          0         1 [...
13098c2ecf20Sopenharmony_ci
13108c2ecf20Sopenharmony_ci  ...] Transmit
13118c2ecf20Sopenharmony_ci  ...] bytes    packets errs drop fifo colls carrier compressed
13128c2ecf20Sopenharmony_ci  ...]  908188     5596    0    0    0     0       0          0
13138c2ecf20Sopenharmony_ci  ...] 1375103    17405    0    0    0     0       0          0
13148c2ecf20Sopenharmony_ci  ...] 1703981     5535    0    0    0     3       0          0
13158c2ecf20Sopenharmony_ci
13168c2ecf20Sopenharmony_ciIn addition, each Channel Bond interface has its own directory.  For
13178c2ecf20Sopenharmony_ciexample, the bond0 device will have a directory called /proc/net/bond0/.
13188c2ecf20Sopenharmony_ciIt will contain information that is specific to that bond, such as the
13198c2ecf20Sopenharmony_cicurrent slaves of the bond, the link status of the slaves, and how
13208c2ecf20Sopenharmony_cimany times the slaves link has failed.
13218c2ecf20Sopenharmony_ci
13228c2ecf20Sopenharmony_ci1.5 SCSI info
13238c2ecf20Sopenharmony_ci-------------
13248c2ecf20Sopenharmony_ci
13258c2ecf20Sopenharmony_ciIf you  have  a  SCSI  host adapter in your system, you'll find a subdirectory
13268c2ecf20Sopenharmony_cinamed after  the driver for this adapter in /proc/scsi. You'll also see a list
13278c2ecf20Sopenharmony_ciof all recognized SCSI devices in /proc/scsi::
13288c2ecf20Sopenharmony_ci
13298c2ecf20Sopenharmony_ci  >cat /proc/scsi/scsi
13308c2ecf20Sopenharmony_ci  Attached devices:
13318c2ecf20Sopenharmony_ci  Host: scsi0 Channel: 00 Id: 00 Lun: 00
13328c2ecf20Sopenharmony_ci    Vendor: IBM      Model: DGHS09U          Rev: 03E0
13338c2ecf20Sopenharmony_ci    Type:   Direct-Access                    ANSI SCSI revision: 03
13348c2ecf20Sopenharmony_ci  Host: scsi0 Channel: 00 Id: 06 Lun: 00
13358c2ecf20Sopenharmony_ci    Vendor: PIONEER  Model: CD-ROM DR-U06S   Rev: 1.04
13368c2ecf20Sopenharmony_ci    Type:   CD-ROM                           ANSI SCSI revision: 02
13378c2ecf20Sopenharmony_ci
13388c2ecf20Sopenharmony_ci
13398c2ecf20Sopenharmony_ciThe directory  named  after  the driver has one file for each adapter found in
13408c2ecf20Sopenharmony_cithe system.  These  files  contain information about the controller, including
13418c2ecf20Sopenharmony_cithe used  IRQ  and  the  IO  address range. The amount of information shown is
13428c2ecf20Sopenharmony_cidependent on  the adapter you use. The example shows the output for an Adaptec
13438c2ecf20Sopenharmony_ciAHA-2940 SCSI adapter::
13448c2ecf20Sopenharmony_ci
13458c2ecf20Sopenharmony_ci  > cat /proc/scsi/aic7xxx/0
13468c2ecf20Sopenharmony_ci
13478c2ecf20Sopenharmony_ci  Adaptec AIC7xxx driver version: 5.1.19/3.2.4
13488c2ecf20Sopenharmony_ci  Compile Options:
13498c2ecf20Sopenharmony_ci    TCQ Enabled By Default : Disabled
13508c2ecf20Sopenharmony_ci    AIC7XXX_PROC_STATS     : Disabled
13518c2ecf20Sopenharmony_ci    AIC7XXX_RESET_DELAY    : 5
13528c2ecf20Sopenharmony_ci  Adapter Configuration:
13538c2ecf20Sopenharmony_ci             SCSI Adapter: Adaptec AHA-294X Ultra SCSI host adapter
13548c2ecf20Sopenharmony_ci                             Ultra Wide Controller
13558c2ecf20Sopenharmony_ci      PCI MMAPed I/O Base: 0xeb001000
13568c2ecf20Sopenharmony_ci   Adapter SEEPROM Config: SEEPROM found and used.
13578c2ecf20Sopenharmony_ci        Adaptec SCSI BIOS: Enabled
13588c2ecf20Sopenharmony_ci                      IRQ: 10
13598c2ecf20Sopenharmony_ci                     SCBs: Active 0, Max Active 2,
13608c2ecf20Sopenharmony_ci                           Allocated 15, HW 16, Page 255
13618c2ecf20Sopenharmony_ci               Interrupts: 160328
13628c2ecf20Sopenharmony_ci        BIOS Control Word: 0x18b6
13638c2ecf20Sopenharmony_ci     Adapter Control Word: 0x005b
13648c2ecf20Sopenharmony_ci     Extended Translation: Enabled
13658c2ecf20Sopenharmony_ci  Disconnect Enable Flags: 0xffff
13668c2ecf20Sopenharmony_ci       Ultra Enable Flags: 0x0001
13678c2ecf20Sopenharmony_ci   Tag Queue Enable Flags: 0x0000
13688c2ecf20Sopenharmony_ci  Ordered Queue Tag Flags: 0x0000
13698c2ecf20Sopenharmony_ci  Default Tag Queue Depth: 8
13708c2ecf20Sopenharmony_ci      Tagged Queue By Device array for aic7xxx host instance 0:
13718c2ecf20Sopenharmony_ci        {255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}
13728c2ecf20Sopenharmony_ci      Actual queue depth per device for aic7xxx host instance 0:
13738c2ecf20Sopenharmony_ci        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
13748c2ecf20Sopenharmony_ci  Statistics:
13758c2ecf20Sopenharmony_ci  (scsi0:0:0:0)
13768c2ecf20Sopenharmony_ci    Device using Wide/Sync transfers at 40.0 MByte/sec, offset 8
13778c2ecf20Sopenharmony_ci    Transinfo settings: current(12/8/1/0), goal(12/8/1/0), user(12/15/1/0)
13788c2ecf20Sopenharmony_ci    Total transfers 160151 (74577 reads and 85574 writes)
13798c2ecf20Sopenharmony_ci  (scsi0:0:6:0)
13808c2ecf20Sopenharmony_ci    Device using Narrow/Sync transfers at 5.0 MByte/sec, offset 15
13818c2ecf20Sopenharmony_ci    Transinfo settings: current(50/15/0/0), goal(50/15/0/0), user(50/15/0/0)
13828c2ecf20Sopenharmony_ci    Total transfers 0 (0 reads and 0 writes)
13838c2ecf20Sopenharmony_ci
13848c2ecf20Sopenharmony_ci
13858c2ecf20Sopenharmony_ci1.6 Parallel port info in /proc/parport
13868c2ecf20Sopenharmony_ci---------------------------------------
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ciThe directory  /proc/parport  contains information about the parallel ports of
13898c2ecf20Sopenharmony_ciyour system.  It  has  one  subdirectory  for  each port, named after the port
13908c2ecf20Sopenharmony_cinumber (0,1,2,...).
13918c2ecf20Sopenharmony_ci
13928c2ecf20Sopenharmony_ciThese directories contain the four files shown in Table 1-10.
13938c2ecf20Sopenharmony_ci
13948c2ecf20Sopenharmony_ci
13958c2ecf20Sopenharmony_ci.. table:: Table 1-10: Files in /proc/parport
13968c2ecf20Sopenharmony_ci
13978c2ecf20Sopenharmony_ci ========= ====================================================================
13988c2ecf20Sopenharmony_ci File      Content
13998c2ecf20Sopenharmony_ci ========= ====================================================================
14008c2ecf20Sopenharmony_ci autoprobe Any IEEE-1284 device ID information that has been acquired.
14018c2ecf20Sopenharmony_ci devices   list of the device drivers using that port. A + will appear by the
14028c2ecf20Sopenharmony_ci           name of the device currently using the port (it might not appear
14038c2ecf20Sopenharmony_ci           against any).
14048c2ecf20Sopenharmony_ci hardware  Parallel port's base address, IRQ line and DMA channel.
14058c2ecf20Sopenharmony_ci irq       IRQ that parport is using for that port. This is in a separate
14068c2ecf20Sopenharmony_ci           file to allow you to alter it by writing a new value in (IRQ
14078c2ecf20Sopenharmony_ci           number or none).
14088c2ecf20Sopenharmony_ci ========= ====================================================================
14098c2ecf20Sopenharmony_ci
14108c2ecf20Sopenharmony_ci1.7 TTY info in /proc/tty
14118c2ecf20Sopenharmony_ci-------------------------
14128c2ecf20Sopenharmony_ci
14138c2ecf20Sopenharmony_ciInformation about  the  available  and actually used tty's can be found in the
14148c2ecf20Sopenharmony_cidirectory /proc/tty. You'll find  entries  for drivers and line disciplines in
14158c2ecf20Sopenharmony_cithis directory, as shown in Table 1-11.
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci
14188c2ecf20Sopenharmony_ci.. table:: Table 1-11: Files in /proc/tty
14198c2ecf20Sopenharmony_ci
14208c2ecf20Sopenharmony_ci ============= ==============================================
14218c2ecf20Sopenharmony_ci File          Content
14228c2ecf20Sopenharmony_ci ============= ==============================================
14238c2ecf20Sopenharmony_ci drivers       list of drivers and their usage
14248c2ecf20Sopenharmony_ci ldiscs        registered line disciplines
14258c2ecf20Sopenharmony_ci driver/serial usage statistic and status of single tty lines
14268c2ecf20Sopenharmony_ci ============= ==============================================
14278c2ecf20Sopenharmony_ci
14288c2ecf20Sopenharmony_ciTo see  which  tty's  are  currently in use, you can simply look into the file
14298c2ecf20Sopenharmony_ci/proc/tty/drivers::
14308c2ecf20Sopenharmony_ci
14318c2ecf20Sopenharmony_ci  > cat /proc/tty/drivers
14328c2ecf20Sopenharmony_ci  pty_slave            /dev/pts      136   0-255 pty:slave
14338c2ecf20Sopenharmony_ci  pty_master           /dev/ptm      128   0-255 pty:master
14348c2ecf20Sopenharmony_ci  pty_slave            /dev/ttyp       3   0-255 pty:slave
14358c2ecf20Sopenharmony_ci  pty_master           /dev/pty        2   0-255 pty:master
14368c2ecf20Sopenharmony_ci  serial               /dev/cua        5   64-67 serial:callout
14378c2ecf20Sopenharmony_ci  serial               /dev/ttyS       4   64-67 serial
14388c2ecf20Sopenharmony_ci  /dev/tty0            /dev/tty0       4       0 system:vtmaster
14398c2ecf20Sopenharmony_ci  /dev/ptmx            /dev/ptmx       5       2 system
14408c2ecf20Sopenharmony_ci  /dev/console         /dev/console    5       1 system:console
14418c2ecf20Sopenharmony_ci  /dev/tty             /dev/tty        5       0 system:/dev/tty
14428c2ecf20Sopenharmony_ci  unknown              /dev/tty        4    1-63 console
14438c2ecf20Sopenharmony_ci
14448c2ecf20Sopenharmony_ci
14458c2ecf20Sopenharmony_ci1.8 Miscellaneous kernel statistics in /proc/stat
14468c2ecf20Sopenharmony_ci-------------------------------------------------
14478c2ecf20Sopenharmony_ci
14488c2ecf20Sopenharmony_ciVarious pieces   of  information about  kernel activity  are  available in the
14498c2ecf20Sopenharmony_ci/proc/stat file.  All  of  the numbers reported  in  this file are  aggregates
14508c2ecf20Sopenharmony_cisince the system first booted.  For a quick look, simply cat the file::
14518c2ecf20Sopenharmony_ci
14528c2ecf20Sopenharmony_ci  > cat /proc/stat
14538c2ecf20Sopenharmony_ci  cpu  2255 34 2290 22625563 6290 127 456 0 0 0
14548c2ecf20Sopenharmony_ci  cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
14558c2ecf20Sopenharmony_ci  cpu1 1123 0 849 11313845 2614 0 18 0 0 0
14568c2ecf20Sopenharmony_ci  intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
14578c2ecf20Sopenharmony_ci  ctxt 1990473
14588c2ecf20Sopenharmony_ci  btime 1062191376
14598c2ecf20Sopenharmony_ci  processes 2915
14608c2ecf20Sopenharmony_ci  procs_running 1
14618c2ecf20Sopenharmony_ci  procs_blocked 0
14628c2ecf20Sopenharmony_ci  softirq 183433 0 21755 12 39 1137 231 21459 2263
14638c2ecf20Sopenharmony_ci
14648c2ecf20Sopenharmony_ciThe very first  "cpu" line aggregates the  numbers in all  of the other "cpuN"
14658c2ecf20Sopenharmony_cilines.  These numbers identify the amount of time the CPU has spent performing
14668c2ecf20Sopenharmony_cidifferent kinds of work.  Time units are in USER_HZ (typically hundredths of a
14678c2ecf20Sopenharmony_cisecond).  The meanings of the columns are as follows, from left to right:
14688c2ecf20Sopenharmony_ci
14698c2ecf20Sopenharmony_ci- user: normal processes executing in user mode
14708c2ecf20Sopenharmony_ci- nice: niced processes executing in user mode
14718c2ecf20Sopenharmony_ci- system: processes executing in kernel mode
14728c2ecf20Sopenharmony_ci- idle: twiddling thumbs
14738c2ecf20Sopenharmony_ci- iowait: In a word, iowait stands for waiting for I/O to complete. But there
14748c2ecf20Sopenharmony_ci  are several problems:
14758c2ecf20Sopenharmony_ci
14768c2ecf20Sopenharmony_ci  1. CPU will not wait for I/O to complete, iowait is the time that a task is
14778c2ecf20Sopenharmony_ci     waiting for I/O to complete. When CPU goes into idle state for
14788c2ecf20Sopenharmony_ci     outstanding task I/O, another task will be scheduled on this CPU.
14798c2ecf20Sopenharmony_ci  2. In a multi-core CPU, the task waiting for I/O to complete is not running
14808c2ecf20Sopenharmony_ci     on any CPU, so the iowait of each CPU is difficult to calculate.
14818c2ecf20Sopenharmony_ci  3. The value of iowait field in /proc/stat will decrease in certain
14828c2ecf20Sopenharmony_ci     conditions.
14838c2ecf20Sopenharmony_ci
14848c2ecf20Sopenharmony_ci  So, the iowait is not reliable by reading from /proc/stat.
14858c2ecf20Sopenharmony_ci- irq: servicing interrupts
14868c2ecf20Sopenharmony_ci- softirq: servicing softirqs
14878c2ecf20Sopenharmony_ci- steal: involuntary wait
14888c2ecf20Sopenharmony_ci- guest: running a normal guest
14898c2ecf20Sopenharmony_ci- guest_nice: running a niced guest
14908c2ecf20Sopenharmony_ci
14918c2ecf20Sopenharmony_ciThe "intr" line gives counts of interrupts  serviced since boot time, for each
14928c2ecf20Sopenharmony_ciof the  possible system interrupts.   The first  column  is the  total of  all
14938c2ecf20Sopenharmony_ciinterrupts serviced  including  unnumbered  architecture specific  interrupts;
14948c2ecf20Sopenharmony_cieach  subsequent column is the  total for that particular numbered interrupt.
14958c2ecf20Sopenharmony_ciUnnumbered interrupts are not shown, only summed into the total.
14968c2ecf20Sopenharmony_ci
14978c2ecf20Sopenharmony_ciThe "ctxt" line gives the total number of context switches across all CPUs.
14988c2ecf20Sopenharmony_ci
14998c2ecf20Sopenharmony_ciThe "btime" line gives  the time at which the  system booted, in seconds since
15008c2ecf20Sopenharmony_cithe Unix epoch.
15018c2ecf20Sopenharmony_ci
15028c2ecf20Sopenharmony_ciThe "processes" line gives the number  of processes and threads created, which
15038c2ecf20Sopenharmony_ciincludes (but  is not limited  to) those  created by  calls to the  fork() and
15048c2ecf20Sopenharmony_ciclone() system calls.
15058c2ecf20Sopenharmony_ci
15068c2ecf20Sopenharmony_ciThe "procs_running" line gives the total number of threads that are
15078c2ecf20Sopenharmony_cirunning or ready to run (i.e., the total number of runnable threads).
15088c2ecf20Sopenharmony_ci
15098c2ecf20Sopenharmony_ciThe   "procs_blocked" line gives  the  number of  processes currently blocked,
15108c2ecf20Sopenharmony_ciwaiting for I/O to complete.
15118c2ecf20Sopenharmony_ci
15128c2ecf20Sopenharmony_ciThe "softirq" line gives counts of softirqs serviced since boot time, for each
15138c2ecf20Sopenharmony_ciof the possible system softirqs. The first column is the total of all
15148c2ecf20Sopenharmony_cisoftirqs serviced; each subsequent column is the total for that particular
15158c2ecf20Sopenharmony_cisoftirq.
15168c2ecf20Sopenharmony_ci
15178c2ecf20Sopenharmony_ci
15188c2ecf20Sopenharmony_ci1.9 Ext4 file system parameters
15198c2ecf20Sopenharmony_ci-------------------------------
15208c2ecf20Sopenharmony_ci
15218c2ecf20Sopenharmony_ciInformation about mounted ext4 file systems can be found in
15228c2ecf20Sopenharmony_ci/proc/fs/ext4.  Each mounted filesystem will have a directory in
15238c2ecf20Sopenharmony_ci/proc/fs/ext4 based on its device name (i.e., /proc/fs/ext4/hdc or
15248c2ecf20Sopenharmony_ci/proc/fs/ext4/dm-0).   The files in each per-device directory are shown
15258c2ecf20Sopenharmony_ciin Table 1-12, below.
15268c2ecf20Sopenharmony_ci
15278c2ecf20Sopenharmony_ci.. table:: Table 1-12: Files in /proc/fs/ext4/<devname>
15288c2ecf20Sopenharmony_ci
15298c2ecf20Sopenharmony_ci ==============  ==========================================================
15308c2ecf20Sopenharmony_ci File            Content
15318c2ecf20Sopenharmony_ci mb_groups       details of multiblock allocator buddy cache of free blocks
15328c2ecf20Sopenharmony_ci ==============  ==========================================================
15338c2ecf20Sopenharmony_ci
15348c2ecf20Sopenharmony_ci1.10 /proc/consoles
15358c2ecf20Sopenharmony_ci-------------------
15368c2ecf20Sopenharmony_ciShows registered system console lines.
15378c2ecf20Sopenharmony_ci
15388c2ecf20Sopenharmony_ciTo see which character device lines are currently used for the system console
15398c2ecf20Sopenharmony_ci/dev/console, you may simply look into the file /proc/consoles::
15408c2ecf20Sopenharmony_ci
15418c2ecf20Sopenharmony_ci  > cat /proc/consoles
15428c2ecf20Sopenharmony_ci  tty0                 -WU (ECp)       4:7
15438c2ecf20Sopenharmony_ci  ttyS0                -W- (Ep)        4:64
15448c2ecf20Sopenharmony_ci
15458c2ecf20Sopenharmony_ciThe columns are:
15468c2ecf20Sopenharmony_ci
15478c2ecf20Sopenharmony_ci+--------------------+-------------------------------------------------------+
15488c2ecf20Sopenharmony_ci| device             | name of the device                                    |
15498c2ecf20Sopenharmony_ci+====================+=======================================================+
15508c2ecf20Sopenharmony_ci| operations         | * R = can do read operations                          |
15518c2ecf20Sopenharmony_ci|                    | * W = can do write operations                         |
15528c2ecf20Sopenharmony_ci|                    | * U = can do unblank                                  |
15538c2ecf20Sopenharmony_ci+--------------------+-------------------------------------------------------+
15548c2ecf20Sopenharmony_ci| flags              | * E = it is enabled                                   |
15558c2ecf20Sopenharmony_ci|                    | * C = it is preferred console                         |
15568c2ecf20Sopenharmony_ci|                    | * B = it is primary boot console                      |
15578c2ecf20Sopenharmony_ci|                    | * p = it is used for printk buffer                    |
15588c2ecf20Sopenharmony_ci|                    | * b = it is not a TTY but a Braille device            |
15598c2ecf20Sopenharmony_ci|                    | * a = it is safe to use when cpu is offline           |
15608c2ecf20Sopenharmony_ci+--------------------+-------------------------------------------------------+
15618c2ecf20Sopenharmony_ci| major:minor        | major and minor number of the device separated by a   |
15628c2ecf20Sopenharmony_ci|                    | colon                                                 |
15638c2ecf20Sopenharmony_ci+--------------------+-------------------------------------------------------+
15648c2ecf20Sopenharmony_ci
15658c2ecf20Sopenharmony_ciSummary
15668c2ecf20Sopenharmony_ci-------
15678c2ecf20Sopenharmony_ci
15688c2ecf20Sopenharmony_ciThe /proc file system serves information about the running system. It not only
15698c2ecf20Sopenharmony_ciallows access to process data but also allows you to request the kernel status
15708c2ecf20Sopenharmony_ciby reading files in the hierarchy.
15718c2ecf20Sopenharmony_ci
15728c2ecf20Sopenharmony_ciThe directory  structure  of /proc reflects the types of information and makes
15738c2ecf20Sopenharmony_ciit easy, if not obvious, where to look for specific data.
15748c2ecf20Sopenharmony_ci
15758c2ecf20Sopenharmony_ciChapter 2: Modifying System Parameters
15768c2ecf20Sopenharmony_ci======================================
15778c2ecf20Sopenharmony_ci
15788c2ecf20Sopenharmony_ciIn This Chapter
15798c2ecf20Sopenharmony_ci---------------
15808c2ecf20Sopenharmony_ci
15818c2ecf20Sopenharmony_ci* Modifying kernel parameters by writing into files found in /proc/sys
15828c2ecf20Sopenharmony_ci* Exploring the files which modify certain parameters
15838c2ecf20Sopenharmony_ci* Review of the /proc/sys file tree
15848c2ecf20Sopenharmony_ci
15858c2ecf20Sopenharmony_ci------------------------------------------------------------------------------
15868c2ecf20Sopenharmony_ci
15878c2ecf20Sopenharmony_ciA very  interesting part of /proc is the directory /proc/sys. This is not only
15888c2ecf20Sopenharmony_cia source  of  information,  it also allows you to change parameters within the
15898c2ecf20Sopenharmony_cikernel. Be  very  careful  when attempting this. You can optimize your system,
15908c2ecf20Sopenharmony_cibut you  can  also  cause  it  to  crash.  Never  alter kernel parameters on a
15918c2ecf20Sopenharmony_ciproduction system.  Set  up  a  development machine and test to make sure that
15928c2ecf20Sopenharmony_cieverything works  the  way  you want it to. You may have no alternative but to
15938c2ecf20Sopenharmony_cireboot the machine once an error has been made.
15948c2ecf20Sopenharmony_ci
15958c2ecf20Sopenharmony_ciTo change  a  value,  simply  echo  the new value into the file.
15968c2ecf20Sopenharmony_ciYou need to be root to do this. You  can  create  your  own  boot script
15978c2ecf20Sopenharmony_cito perform this every time your system boots.
15988c2ecf20Sopenharmony_ci
15998c2ecf20Sopenharmony_ciThe files  in /proc/sys can be used to fine tune and monitor miscellaneous and
16008c2ecf20Sopenharmony_cigeneral things  in  the operation of the Linux kernel. Since some of the files
16018c2ecf20Sopenharmony_cican inadvertently  disrupt  your  system,  it  is  advisable  to  read  both
16028c2ecf20Sopenharmony_cidocumentation and  source  before actually making adjustments. In any case, be
16038c2ecf20Sopenharmony_civery careful  when  writing  to  any  of these files. The entries in /proc may
16048c2ecf20Sopenharmony_cichange slightly between the 2.1.* and the 2.2 kernel, so if there is any doubt
16058c2ecf20Sopenharmony_cireview the kernel documentation in the directory /usr/src/linux/Documentation.
16068c2ecf20Sopenharmony_ciThis chapter  is  heavily  based  on the documentation included in the pre 2.2
16078c2ecf20Sopenharmony_cikernels, and became part of it in version 2.2.1 of the Linux kernel.
16088c2ecf20Sopenharmony_ci
16098c2ecf20Sopenharmony_ciPlease see: Documentation/admin-guide/sysctl/ directory for descriptions of these
16108c2ecf20Sopenharmony_cientries.
16118c2ecf20Sopenharmony_ci
16128c2ecf20Sopenharmony_ciSummary
16138c2ecf20Sopenharmony_ci-------
16148c2ecf20Sopenharmony_ci
16158c2ecf20Sopenharmony_ciCertain aspects  of  kernel  behavior  can be modified at runtime, without the
16168c2ecf20Sopenharmony_cineed to  recompile  the kernel, or even to reboot the system. The files in the
16178c2ecf20Sopenharmony_ci/proc/sys tree  can  not only be read, but also modified. You can use the echo
16188c2ecf20Sopenharmony_cicommand to write value into these files, thereby changing the default settings
16198c2ecf20Sopenharmony_ciof the kernel.
16208c2ecf20Sopenharmony_ci
16218c2ecf20Sopenharmony_ci
16228c2ecf20Sopenharmony_ciChapter 3: Per-process Parameters
16238c2ecf20Sopenharmony_ci=================================
16248c2ecf20Sopenharmony_ci
16258c2ecf20Sopenharmony_ci3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj- Adjust the oom-killer score
16268c2ecf20Sopenharmony_ci--------------------------------------------------------------------------------
16278c2ecf20Sopenharmony_ci
16288c2ecf20Sopenharmony_ciThese files can be used to adjust the badness heuristic used to select which
16298c2ecf20Sopenharmony_ciprocess gets killed in out of memory (oom) conditions.
16308c2ecf20Sopenharmony_ci
16318c2ecf20Sopenharmony_ciThe badness heuristic assigns a value to each candidate task ranging from 0
16328c2ecf20Sopenharmony_ci(never kill) to 1000 (always kill) to determine which process is targeted.  The
16338c2ecf20Sopenharmony_ciunits are roughly a proportion along that range of allowed memory the process
16348c2ecf20Sopenharmony_cimay allocate from based on an estimation of its current memory and swap use.
16358c2ecf20Sopenharmony_ciFor example, if a task is using all allowed memory, its badness score will be
16368c2ecf20Sopenharmony_ci1000.  If it is using half of its allowed memory, its score will be 500.
16378c2ecf20Sopenharmony_ci
16388c2ecf20Sopenharmony_ciThe amount of "allowed" memory depends on the context in which the oom killer
16398c2ecf20Sopenharmony_ciwas called.  If it is due to the memory assigned to the allocating task's cpuset
16408c2ecf20Sopenharmony_cibeing exhausted, the allowed memory represents the set of mems assigned to that
16418c2ecf20Sopenharmony_cicpuset.  If it is due to a mempolicy's node(s) being exhausted, the allowed
16428c2ecf20Sopenharmony_cimemory represents the set of mempolicy nodes.  If it is due to a memory
16438c2ecf20Sopenharmony_cilimit (or swap limit) being reached, the allowed memory is that configured
16448c2ecf20Sopenharmony_cilimit.  Finally, if it is due to the entire system being out of memory, the
16458c2ecf20Sopenharmony_ciallowed memory represents all allocatable resources.
16468c2ecf20Sopenharmony_ci
16478c2ecf20Sopenharmony_ciThe value of /proc/<pid>/oom_score_adj is added to the badness score before it
16488c2ecf20Sopenharmony_ciis used to determine which task to kill.  Acceptable values range from -1000
16498c2ecf20Sopenharmony_ci(OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX).  This allows userspace to
16508c2ecf20Sopenharmony_cipolarize the preference for oom killing either by always preferring a certain
16518c2ecf20Sopenharmony_citask or completely disabling it.  The lowest possible value, -1000, is
16528c2ecf20Sopenharmony_ciequivalent to disabling oom killing entirely for that task since it will always
16538c2ecf20Sopenharmony_cireport a badness score of 0.
16548c2ecf20Sopenharmony_ci
16558c2ecf20Sopenharmony_ciConsequently, it is very simple for userspace to define the amount of memory to
16568c2ecf20Sopenharmony_ciconsider for each task.  Setting a /proc/<pid>/oom_score_adj value of +500, for
16578c2ecf20Sopenharmony_ciexample, is roughly equivalent to allowing the remainder of tasks sharing the
16588c2ecf20Sopenharmony_cisame system, cpuset, mempolicy, or memory controller resources to use at least
16598c2ecf20Sopenharmony_ci50% more memory.  A value of -500, on the other hand, would be roughly
16608c2ecf20Sopenharmony_ciequivalent to discounting 50% of the task's allowed memory from being considered
16618c2ecf20Sopenharmony_cias scoring against the task.
16628c2ecf20Sopenharmony_ci
16638c2ecf20Sopenharmony_ciFor backwards compatibility with previous kernels, /proc/<pid>/oom_adj may also
16648c2ecf20Sopenharmony_cibe used to tune the badness score.  Its acceptable values range from -16
16658c2ecf20Sopenharmony_ci(OOM_ADJUST_MIN) to +15 (OOM_ADJUST_MAX) and a special value of -17
16668c2ecf20Sopenharmony_ci(OOM_DISABLE) to disable oom killing entirely for that task.  Its value is
16678c2ecf20Sopenharmony_ciscaled linearly with /proc/<pid>/oom_score_adj.
16688c2ecf20Sopenharmony_ci
16698c2ecf20Sopenharmony_ciThe value of /proc/<pid>/oom_score_adj may be reduced no lower than the last
16708c2ecf20Sopenharmony_civalue set by a CAP_SYS_RESOURCE process. To reduce the value any lower
16718c2ecf20Sopenharmony_cirequires CAP_SYS_RESOURCE.
16728c2ecf20Sopenharmony_ci
16738c2ecf20Sopenharmony_ci
16748c2ecf20Sopenharmony_ci3.2 /proc/<pid>/oom_score - Display current oom-killer score
16758c2ecf20Sopenharmony_ci-------------------------------------------------------------
16768c2ecf20Sopenharmony_ci
16778c2ecf20Sopenharmony_ciThis file can be used to check the current score used by the oom-killer for
16788c2ecf20Sopenharmony_ciany given <pid>. Use it together with /proc/<pid>/oom_score_adj to tune which
16798c2ecf20Sopenharmony_ciprocess should be killed in an out-of-memory situation.
16808c2ecf20Sopenharmony_ci
16818c2ecf20Sopenharmony_ciPlease note that the exported value includes oom_score_adj so it is
16828c2ecf20Sopenharmony_cieffectively in range [0,2000].
16838c2ecf20Sopenharmony_ci
16848c2ecf20Sopenharmony_ci
16858c2ecf20Sopenharmony_ci3.3  /proc/<pid>/io - Display the IO accounting fields
16868c2ecf20Sopenharmony_ci-------------------------------------------------------
16878c2ecf20Sopenharmony_ci
16888c2ecf20Sopenharmony_ciThis file contains IO statistics for each running process.
16898c2ecf20Sopenharmony_ci
16908c2ecf20Sopenharmony_ciExample
16918c2ecf20Sopenharmony_ci~~~~~~~
16928c2ecf20Sopenharmony_ci
16938c2ecf20Sopenharmony_ci::
16948c2ecf20Sopenharmony_ci
16958c2ecf20Sopenharmony_ci    test:/tmp # dd if=/dev/zero of=/tmp/test.dat &
16968c2ecf20Sopenharmony_ci    [1] 3828
16978c2ecf20Sopenharmony_ci
16988c2ecf20Sopenharmony_ci    test:/tmp # cat /proc/3828/io
16998c2ecf20Sopenharmony_ci    rchar: 323934931
17008c2ecf20Sopenharmony_ci    wchar: 323929600
17018c2ecf20Sopenharmony_ci    syscr: 632687
17028c2ecf20Sopenharmony_ci    syscw: 632675
17038c2ecf20Sopenharmony_ci    read_bytes: 0
17048c2ecf20Sopenharmony_ci    write_bytes: 323932160
17058c2ecf20Sopenharmony_ci    cancelled_write_bytes: 0
17068c2ecf20Sopenharmony_ci
17078c2ecf20Sopenharmony_ci
17088c2ecf20Sopenharmony_ciDescription
17098c2ecf20Sopenharmony_ci~~~~~~~~~~~
17108c2ecf20Sopenharmony_ci
17118c2ecf20Sopenharmony_circhar
17128c2ecf20Sopenharmony_ci^^^^^
17138c2ecf20Sopenharmony_ci
17148c2ecf20Sopenharmony_ciI/O counter: chars read
17158c2ecf20Sopenharmony_ciThe number of bytes which this task has caused to be read from storage. This
17168c2ecf20Sopenharmony_ciis simply the sum of bytes which this process passed to read() and pread().
17178c2ecf20Sopenharmony_ciIt includes things like tty IO and it is unaffected by whether or not actual
17188c2ecf20Sopenharmony_ciphysical disk IO was required (the read might have been satisfied from
17198c2ecf20Sopenharmony_cipagecache).
17208c2ecf20Sopenharmony_ci
17218c2ecf20Sopenharmony_ci
17228c2ecf20Sopenharmony_ciwchar
17238c2ecf20Sopenharmony_ci^^^^^
17248c2ecf20Sopenharmony_ci
17258c2ecf20Sopenharmony_ciI/O counter: chars written
17268c2ecf20Sopenharmony_ciThe number of bytes which this task has caused, or shall cause to be written
17278c2ecf20Sopenharmony_cito disk. Similar caveats apply here as with rchar.
17288c2ecf20Sopenharmony_ci
17298c2ecf20Sopenharmony_ci
17308c2ecf20Sopenharmony_cisyscr
17318c2ecf20Sopenharmony_ci^^^^^
17328c2ecf20Sopenharmony_ci
17338c2ecf20Sopenharmony_ciI/O counter: read syscalls
17348c2ecf20Sopenharmony_ciAttempt to count the number of read I/O operations, i.e. syscalls like read()
17358c2ecf20Sopenharmony_ciand pread().
17368c2ecf20Sopenharmony_ci
17378c2ecf20Sopenharmony_ci
17388c2ecf20Sopenharmony_cisyscw
17398c2ecf20Sopenharmony_ci^^^^^
17408c2ecf20Sopenharmony_ci
17418c2ecf20Sopenharmony_ciI/O counter: write syscalls
17428c2ecf20Sopenharmony_ciAttempt to count the number of write I/O operations, i.e. syscalls like
17438c2ecf20Sopenharmony_ciwrite() and pwrite().
17448c2ecf20Sopenharmony_ci
17458c2ecf20Sopenharmony_ci
17468c2ecf20Sopenharmony_ciread_bytes
17478c2ecf20Sopenharmony_ci^^^^^^^^^^
17488c2ecf20Sopenharmony_ci
17498c2ecf20Sopenharmony_ciI/O counter: bytes read
17508c2ecf20Sopenharmony_ciAttempt to count the number of bytes which this process really did cause to
17518c2ecf20Sopenharmony_cibe fetched from the storage layer. Done at the submit_bio() level, so it is
17528c2ecf20Sopenharmony_ciaccurate for block-backed filesystems. <please add status regarding NFS and
17538c2ecf20Sopenharmony_ciCIFS at a later time>
17548c2ecf20Sopenharmony_ci
17558c2ecf20Sopenharmony_ci
17568c2ecf20Sopenharmony_ciwrite_bytes
17578c2ecf20Sopenharmony_ci^^^^^^^^^^^
17588c2ecf20Sopenharmony_ci
17598c2ecf20Sopenharmony_ciI/O counter: bytes written
17608c2ecf20Sopenharmony_ciAttempt to count the number of bytes which this process caused to be sent to
17618c2ecf20Sopenharmony_cithe storage layer. This is done at page-dirtying time.
17628c2ecf20Sopenharmony_ci
17638c2ecf20Sopenharmony_ci
17648c2ecf20Sopenharmony_cicancelled_write_bytes
17658c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^
17668c2ecf20Sopenharmony_ci
17678c2ecf20Sopenharmony_ciThe big inaccuracy here is truncate. If a process writes 1MB to a file and
17688c2ecf20Sopenharmony_cithen deletes the file, it will in fact perform no writeout. But it will have
17698c2ecf20Sopenharmony_cibeen accounted as having caused 1MB of write.
17708c2ecf20Sopenharmony_ciIn other words: The number of bytes which this process caused to not happen,
17718c2ecf20Sopenharmony_ciby truncating pagecache. A task can cause "negative" IO too. If this task
17728c2ecf20Sopenharmony_citruncates some dirty pagecache, some IO which another task has been accounted
17738c2ecf20Sopenharmony_cifor (in its write_bytes) will not be happening. We _could_ just subtract that
17748c2ecf20Sopenharmony_cifrom the truncating task's write_bytes, but there is information loss in doing
17758c2ecf20Sopenharmony_cithat.
17768c2ecf20Sopenharmony_ci
17778c2ecf20Sopenharmony_ci
17788c2ecf20Sopenharmony_ci.. Note::
17798c2ecf20Sopenharmony_ci
17808c2ecf20Sopenharmony_ci   At its current implementation state, this is a bit racy on 32-bit machines:
17818c2ecf20Sopenharmony_ci   if process A reads process B's /proc/pid/io while process B is updating one
17828c2ecf20Sopenharmony_ci   of those 64-bit counters, process A could see an intermediate result.
17838c2ecf20Sopenharmony_ci
17848c2ecf20Sopenharmony_ci
17858c2ecf20Sopenharmony_ciMore information about this can be found within the taskstats documentation in
17868c2ecf20Sopenharmony_ciDocumentation/accounting.
17878c2ecf20Sopenharmony_ci
17888c2ecf20Sopenharmony_ci3.4 /proc/<pid>/coredump_filter - Core dump filtering settings
17898c2ecf20Sopenharmony_ci---------------------------------------------------------------
17908c2ecf20Sopenharmony_ciWhen a process is dumped, all anonymous memory is written to a core file as
17918c2ecf20Sopenharmony_cilong as the size of the core file isn't limited. But sometimes we don't want
17928c2ecf20Sopenharmony_cito dump some memory segments, for example, huge shared memory or DAX.
17938c2ecf20Sopenharmony_ciConversely, sometimes we want to save file-backed memory segments into a core
17948c2ecf20Sopenharmony_cifile, not only the individual files.
17958c2ecf20Sopenharmony_ci
17968c2ecf20Sopenharmony_ci/proc/<pid>/coredump_filter allows you to customize which memory segments
17978c2ecf20Sopenharmony_ciwill be dumped when the <pid> process is dumped. coredump_filter is a bitmask
17988c2ecf20Sopenharmony_ciof memory types. If a bit of the bitmask is set, memory segments of the
17998c2ecf20Sopenharmony_cicorresponding memory type are dumped, otherwise they are not dumped.
18008c2ecf20Sopenharmony_ci
18018c2ecf20Sopenharmony_ciThe following 9 memory types are supported:
18028c2ecf20Sopenharmony_ci
18038c2ecf20Sopenharmony_ci  - (bit 0) anonymous private memory
18048c2ecf20Sopenharmony_ci  - (bit 1) anonymous shared memory
18058c2ecf20Sopenharmony_ci  - (bit 2) file-backed private memory
18068c2ecf20Sopenharmony_ci  - (bit 3) file-backed shared memory
18078c2ecf20Sopenharmony_ci  - (bit 4) ELF header pages in file-backed private memory areas (it is
18088c2ecf20Sopenharmony_ci    effective only if the bit 2 is cleared)
18098c2ecf20Sopenharmony_ci  - (bit 5) hugetlb private memory
18108c2ecf20Sopenharmony_ci  - (bit 6) hugetlb shared memory
18118c2ecf20Sopenharmony_ci  - (bit 7) DAX private memory
18128c2ecf20Sopenharmony_ci  - (bit 8) DAX shared memory
18138c2ecf20Sopenharmony_ci
18148c2ecf20Sopenharmony_ci  Note that MMIO pages such as frame buffer are never dumped and vDSO pages
18158c2ecf20Sopenharmony_ci  are always dumped regardless of the bitmask status.
18168c2ecf20Sopenharmony_ci
18178c2ecf20Sopenharmony_ci  Note that bits 0-4 don't affect hugetlb or DAX memory. hugetlb memory is
18188c2ecf20Sopenharmony_ci  only affected by bit 5-6, and DAX is only affected by bits 7-8.
18198c2ecf20Sopenharmony_ci
18208c2ecf20Sopenharmony_ciThe default value of coredump_filter is 0x33; this means all anonymous memory
18218c2ecf20Sopenharmony_cisegments, ELF header pages and hugetlb private memory are dumped.
18228c2ecf20Sopenharmony_ci
18238c2ecf20Sopenharmony_ciIf you don't want to dump all shared memory segments attached to pid 1234,
18248c2ecf20Sopenharmony_ciwrite 0x31 to the process's proc file::
18258c2ecf20Sopenharmony_ci
18268c2ecf20Sopenharmony_ci  $ echo 0x31 > /proc/1234/coredump_filter
18278c2ecf20Sopenharmony_ci
18288c2ecf20Sopenharmony_ciWhen a new process is created, the process inherits the bitmask status from its
18298c2ecf20Sopenharmony_ciparent. It is useful to set up coredump_filter before the program runs.
18308c2ecf20Sopenharmony_ciFor example::
18318c2ecf20Sopenharmony_ci
18328c2ecf20Sopenharmony_ci  $ echo 0x7 > /proc/self/coredump_filter
18338c2ecf20Sopenharmony_ci  $ ./some_program
18348c2ecf20Sopenharmony_ci
18358c2ecf20Sopenharmony_ci3.5	/proc/<pid>/mountinfo - Information about mounts
18368c2ecf20Sopenharmony_ci--------------------------------------------------------
18378c2ecf20Sopenharmony_ci
18388c2ecf20Sopenharmony_ciThis file contains lines of the form::
18398c2ecf20Sopenharmony_ci
18408c2ecf20Sopenharmony_ci    36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
18418c2ecf20Sopenharmony_ci    (1)(2)(3)   (4)   (5)      (6)      (7)   (8) (9)   (10)         (11)
18428c2ecf20Sopenharmony_ci
18438c2ecf20Sopenharmony_ci    (1) mount ID:  unique identifier of the mount (may be reused after umount)
18448c2ecf20Sopenharmony_ci    (2) parent ID:  ID of parent (or of self for the top of the mount tree)
18458c2ecf20Sopenharmony_ci    (3) major:minor:  value of st_dev for files on filesystem
18468c2ecf20Sopenharmony_ci    (4) root:  root of the mount within the filesystem
18478c2ecf20Sopenharmony_ci    (5) mount point:  mount point relative to the process's root
18488c2ecf20Sopenharmony_ci    (6) mount options:  per mount options
18498c2ecf20Sopenharmony_ci    (7) optional fields:  zero or more fields of the form "tag[:value]"
18508c2ecf20Sopenharmony_ci    (8) separator:  marks the end of the optional fields
18518c2ecf20Sopenharmony_ci    (9) filesystem type:  name of filesystem of the form "type[.subtype]"
18528c2ecf20Sopenharmony_ci    (10) mount source:  filesystem specific information or "none"
18538c2ecf20Sopenharmony_ci    (11) super options:  per super block options
18548c2ecf20Sopenharmony_ci
18558c2ecf20Sopenharmony_ciParsers should ignore all unrecognised optional fields.  Currently the
18568c2ecf20Sopenharmony_cipossible optional fields are:
18578c2ecf20Sopenharmony_ci
18588c2ecf20Sopenharmony_ci================  ==============================================================
18598c2ecf20Sopenharmony_cishared:X          mount is shared in peer group X
18608c2ecf20Sopenharmony_cimaster:X          mount is slave to peer group X
18618c2ecf20Sopenharmony_cipropagate_from:X  mount is slave and receives propagation from peer group X [#]_
18628c2ecf20Sopenharmony_ciunbindable        mount is unbindable
18638c2ecf20Sopenharmony_ci================  ==============================================================
18648c2ecf20Sopenharmony_ci
18658c2ecf20Sopenharmony_ci.. [#] X is the closest dominant peer group under the process's root.  If
18668c2ecf20Sopenharmony_ci       X is the immediate master of the mount, or if there's no dominant peer
18678c2ecf20Sopenharmony_ci       group under the same root, then only the "master:X" field is present
18688c2ecf20Sopenharmony_ci       and not the "propagate_from:X" field.
18698c2ecf20Sopenharmony_ci
18708c2ecf20Sopenharmony_ciFor more information on mount propagation see:
18718c2ecf20Sopenharmony_ci
18728c2ecf20Sopenharmony_ci  Documentation/filesystems/sharedsubtree.rst
18738c2ecf20Sopenharmony_ci
18748c2ecf20Sopenharmony_ci
18758c2ecf20Sopenharmony_ci3.6	/proc/<pid>/comm  & /proc/<pid>/task/<tid>/comm
18768c2ecf20Sopenharmony_ci--------------------------------------------------------
18778c2ecf20Sopenharmony_ciThese files provide a method to access a task's comm value. It also allows for
18788c2ecf20Sopenharmony_cia task to set its own or one of its thread siblings comm value. The comm value
18798c2ecf20Sopenharmony_ciis limited in size compared to the cmdline value, so writing anything longer
18808c2ecf20Sopenharmony_cithen the kernel's TASK_COMM_LEN (currently 16 chars) will result in a truncated
18818c2ecf20Sopenharmony_cicomm value.
18828c2ecf20Sopenharmony_ci
18838c2ecf20Sopenharmony_ci
18848c2ecf20Sopenharmony_ci3.7	/proc/<pid>/task/<tid>/children - Information about task children
18858c2ecf20Sopenharmony_ci-------------------------------------------------------------------------
18868c2ecf20Sopenharmony_ciThis file provides a fast way to retrieve first level children pids
18878c2ecf20Sopenharmony_ciof a task pointed by <pid>/<tid> pair. The format is a space separated
18888c2ecf20Sopenharmony_cistream of pids.
18898c2ecf20Sopenharmony_ci
18908c2ecf20Sopenharmony_ciNote the "first level" here -- if a child has its own children they will
18918c2ecf20Sopenharmony_cinot be listed here; one needs to read /proc/<children-pid>/task/<tid>/children
18928c2ecf20Sopenharmony_cito obtain the descendants.
18938c2ecf20Sopenharmony_ci
18948c2ecf20Sopenharmony_ciSince this interface is intended to be fast and cheap it doesn't
18958c2ecf20Sopenharmony_ciguarantee to provide precise results and some children might be
18968c2ecf20Sopenharmony_ciskipped, especially if they've exited right after we printed their
18978c2ecf20Sopenharmony_cipids, so one needs to either stop or freeze processes being inspected
18988c2ecf20Sopenharmony_ciif precise results are needed.
18998c2ecf20Sopenharmony_ci
19008c2ecf20Sopenharmony_ci
19018c2ecf20Sopenharmony_ci3.8	/proc/<pid>/fdinfo/<fd> - Information about opened file
19028c2ecf20Sopenharmony_ci---------------------------------------------------------------
19038c2ecf20Sopenharmony_ciThis file provides information associated with an opened file. The regular
19048c2ecf20Sopenharmony_cifiles have at least three fields -- 'pos', 'flags' and 'mnt_id'. The 'pos'
19058c2ecf20Sopenharmony_cirepresents the current offset of the opened file in decimal form [see lseek(2)
19068c2ecf20Sopenharmony_cifor details], 'flags' denotes the octal O_xxx mask the file has been
19078c2ecf20Sopenharmony_cicreated with [see open(2) for details] and 'mnt_id' represents mount ID of
19088c2ecf20Sopenharmony_cithe file system containing the opened file [see 3.5 /proc/<pid>/mountinfo
19098c2ecf20Sopenharmony_cifor details].
19108c2ecf20Sopenharmony_ci
19118c2ecf20Sopenharmony_ciA typical output is::
19128c2ecf20Sopenharmony_ci
19138c2ecf20Sopenharmony_ci	pos:	0
19148c2ecf20Sopenharmony_ci	flags:	0100002
19158c2ecf20Sopenharmony_ci	mnt_id:	19
19168c2ecf20Sopenharmony_ci
19178c2ecf20Sopenharmony_ciAll locks associated with a file descriptor are shown in its fdinfo too::
19188c2ecf20Sopenharmony_ci
19198c2ecf20Sopenharmony_ci    lock:       1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
19208c2ecf20Sopenharmony_ci
19218c2ecf20Sopenharmony_ciThe files such as eventfd, fsnotify, signalfd, epoll among the regular pos/flags
19228c2ecf20Sopenharmony_cipair provide additional information particular to the objects they represent.
19238c2ecf20Sopenharmony_ci
19248c2ecf20Sopenharmony_ciEventfd files
19258c2ecf20Sopenharmony_ci~~~~~~~~~~~~~
19268c2ecf20Sopenharmony_ci
19278c2ecf20Sopenharmony_ci::
19288c2ecf20Sopenharmony_ci
19298c2ecf20Sopenharmony_ci	pos:	0
19308c2ecf20Sopenharmony_ci	flags:	04002
19318c2ecf20Sopenharmony_ci	mnt_id:	9
19328c2ecf20Sopenharmony_ci	eventfd-count:	5a
19338c2ecf20Sopenharmony_ci
19348c2ecf20Sopenharmony_ciwhere 'eventfd-count' is hex value of a counter.
19358c2ecf20Sopenharmony_ci
19368c2ecf20Sopenharmony_ciSignalfd files
19378c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~
19388c2ecf20Sopenharmony_ci
19398c2ecf20Sopenharmony_ci::
19408c2ecf20Sopenharmony_ci
19418c2ecf20Sopenharmony_ci	pos:	0
19428c2ecf20Sopenharmony_ci	flags:	04002
19438c2ecf20Sopenharmony_ci	mnt_id:	9
19448c2ecf20Sopenharmony_ci	sigmask:	0000000000000200
19458c2ecf20Sopenharmony_ci
19468c2ecf20Sopenharmony_ciwhere 'sigmask' is hex value of the signal mask associated
19478c2ecf20Sopenharmony_ciwith a file.
19488c2ecf20Sopenharmony_ci
19498c2ecf20Sopenharmony_ciEpoll files
19508c2ecf20Sopenharmony_ci~~~~~~~~~~~
19518c2ecf20Sopenharmony_ci
19528c2ecf20Sopenharmony_ci::
19538c2ecf20Sopenharmony_ci
19548c2ecf20Sopenharmony_ci	pos:	0
19558c2ecf20Sopenharmony_ci	flags:	02
19568c2ecf20Sopenharmony_ci	mnt_id:	9
19578c2ecf20Sopenharmony_ci	tfd:        5 events:       1d data: ffffffffffffffff pos:0 ino:61af sdev:7
19588c2ecf20Sopenharmony_ci
19598c2ecf20Sopenharmony_ciwhere 'tfd' is a target file descriptor number in decimal form,
19608c2ecf20Sopenharmony_ci'events' is events mask being watched and the 'data' is data
19618c2ecf20Sopenharmony_ciassociated with a target [see epoll(7) for more details].
19628c2ecf20Sopenharmony_ci
19638c2ecf20Sopenharmony_ciThe 'pos' is current offset of the target file in decimal form
19648c2ecf20Sopenharmony_ci[see lseek(2)], 'ino' and 'sdev' are inode and device numbers
19658c2ecf20Sopenharmony_ciwhere target file resides, all in hex format.
19668c2ecf20Sopenharmony_ci
19678c2ecf20Sopenharmony_ciFsnotify files
19688c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~
19698c2ecf20Sopenharmony_ciFor inotify files the format is the following::
19708c2ecf20Sopenharmony_ci
19718c2ecf20Sopenharmony_ci	pos:	0
19728c2ecf20Sopenharmony_ci	flags:	02000000
19738c2ecf20Sopenharmony_ci	inotify wd:3 ino:9e7e sdev:800013 mask:800afce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:7e9e0000640d1b6d
19748c2ecf20Sopenharmony_ci
19758c2ecf20Sopenharmony_ciwhere 'wd' is a watch descriptor in decimal form, i.e. a target file
19768c2ecf20Sopenharmony_cidescriptor number, 'ino' and 'sdev' are inode and device where the
19778c2ecf20Sopenharmony_citarget file resides and the 'mask' is the mask of events, all in hex
19788c2ecf20Sopenharmony_ciform [see inotify(7) for more details].
19798c2ecf20Sopenharmony_ci
19808c2ecf20Sopenharmony_ciIf the kernel was built with exportfs support, the path to the target
19818c2ecf20Sopenharmony_cifile is encoded as a file handle.  The file handle is provided by three
19828c2ecf20Sopenharmony_cifields 'fhandle-bytes', 'fhandle-type' and 'f_handle', all in hex
19838c2ecf20Sopenharmony_ciformat.
19848c2ecf20Sopenharmony_ci
19858c2ecf20Sopenharmony_ciIf the kernel is built without exportfs support the file handle won't be
19868c2ecf20Sopenharmony_ciprinted out.
19878c2ecf20Sopenharmony_ci
19888c2ecf20Sopenharmony_ciIf there is no inotify mark attached yet the 'inotify' line will be omitted.
19898c2ecf20Sopenharmony_ci
19908c2ecf20Sopenharmony_ciFor fanotify files the format is::
19918c2ecf20Sopenharmony_ci
19928c2ecf20Sopenharmony_ci	pos:	0
19938c2ecf20Sopenharmony_ci	flags:	02
19948c2ecf20Sopenharmony_ci	mnt_id:	9
19958c2ecf20Sopenharmony_ci	fanotify flags:10 event-flags:0
19968c2ecf20Sopenharmony_ci	fanotify mnt_id:12 mflags:40 mask:38 ignored_mask:40000003
19978c2ecf20Sopenharmony_ci	fanotify ino:4f969 sdev:800013 mflags:0 mask:3b ignored_mask:40000000 fhandle-bytes:8 fhandle-type:1 f_handle:69f90400c275b5b4
19988c2ecf20Sopenharmony_ci
19998c2ecf20Sopenharmony_ciwhere fanotify 'flags' and 'event-flags' are values used in fanotify_init
20008c2ecf20Sopenharmony_cicall, 'mnt_id' is the mount point identifier, 'mflags' is the value of
20018c2ecf20Sopenharmony_ciflags associated with mark which are tracked separately from events
20028c2ecf20Sopenharmony_cimask. 'ino' and 'sdev' are target inode and device, 'mask' is the events
20038c2ecf20Sopenharmony_cimask and 'ignored_mask' is the mask of events which are to be ignored.
20048c2ecf20Sopenharmony_ciAll are in hex format. Incorporation of 'mflags', 'mask' and 'ignored_mask'
20058c2ecf20Sopenharmony_ciprovide information about flags and mask used in fanotify_mark
20068c2ecf20Sopenharmony_cicall [see fsnotify manpage for details].
20078c2ecf20Sopenharmony_ci
20088c2ecf20Sopenharmony_ciWhile the first three lines are mandatory and always printed, the rest is
20098c2ecf20Sopenharmony_cioptional and may be omitted if no marks created yet.
20108c2ecf20Sopenharmony_ci
20118c2ecf20Sopenharmony_ciTimerfd files
20128c2ecf20Sopenharmony_ci~~~~~~~~~~~~~
20138c2ecf20Sopenharmony_ci
20148c2ecf20Sopenharmony_ci::
20158c2ecf20Sopenharmony_ci
20168c2ecf20Sopenharmony_ci	pos:	0
20178c2ecf20Sopenharmony_ci	flags:	02
20188c2ecf20Sopenharmony_ci	mnt_id:	9
20198c2ecf20Sopenharmony_ci	clockid: 0
20208c2ecf20Sopenharmony_ci	ticks: 0
20218c2ecf20Sopenharmony_ci	settime flags: 01
20228c2ecf20Sopenharmony_ci	it_value: (0, 49406829)
20238c2ecf20Sopenharmony_ci	it_interval: (1, 0)
20248c2ecf20Sopenharmony_ci
20258c2ecf20Sopenharmony_ciwhere 'clockid' is the clock type and 'ticks' is the number of the timer expirations
20268c2ecf20Sopenharmony_cithat have occurred [see timerfd_create(2) for details]. 'settime flags' are
20278c2ecf20Sopenharmony_ciflags in octal form been used to setup the timer [see timerfd_settime(2) for
20288c2ecf20Sopenharmony_cidetails]. 'it_value' is remaining time until the timer expiration.
20298c2ecf20Sopenharmony_ci'it_interval' is the interval for the timer. Note the timer might be set up
20308c2ecf20Sopenharmony_ciwith TIMER_ABSTIME option which will be shown in 'settime flags', but 'it_value'
20318c2ecf20Sopenharmony_cistill exhibits timer's remaining time.
20328c2ecf20Sopenharmony_ci
20338c2ecf20Sopenharmony_ci3.9	/proc/<pid>/map_files - Information about memory mapped files
20348c2ecf20Sopenharmony_ci---------------------------------------------------------------------
20358c2ecf20Sopenharmony_ciThis directory contains symbolic links which represent memory mapped files
20368c2ecf20Sopenharmony_cithe process is maintaining.  Example output::
20378c2ecf20Sopenharmony_ci
20388c2ecf20Sopenharmony_ci     | lr-------- 1 root root 64 Jan 27 11:24 333c600000-333c620000 -> /usr/lib64/ld-2.18.so
20398c2ecf20Sopenharmony_ci     | lr-------- 1 root root 64 Jan 27 11:24 333c81f000-333c820000 -> /usr/lib64/ld-2.18.so
20408c2ecf20Sopenharmony_ci     | lr-------- 1 root root 64 Jan 27 11:24 333c820000-333c821000 -> /usr/lib64/ld-2.18.so
20418c2ecf20Sopenharmony_ci     | ...
20428c2ecf20Sopenharmony_ci     | lr-------- 1 root root 64 Jan 27 11:24 35d0421000-35d0422000 -> /usr/lib64/libselinux.so.1
20438c2ecf20Sopenharmony_ci     | lr-------- 1 root root 64 Jan 27 11:24 400000-41a000 -> /usr/bin/ls
20448c2ecf20Sopenharmony_ci
20458c2ecf20Sopenharmony_ciThe name of a link represents the virtual memory bounds of a mapping, i.e.
20468c2ecf20Sopenharmony_civm_area_struct::vm_start-vm_area_struct::vm_end.
20478c2ecf20Sopenharmony_ci
20488c2ecf20Sopenharmony_ciThe main purpose of the map_files is to retrieve a set of memory mapped
20498c2ecf20Sopenharmony_cifiles in a fast way instead of parsing /proc/<pid>/maps or
20508c2ecf20Sopenharmony_ci/proc/<pid>/smaps, both of which contain many more records.  At the same
20518c2ecf20Sopenharmony_citime one can open(2) mappings from the listings of two processes and
20528c2ecf20Sopenharmony_cicomparing their inode numbers to figure out which anonymous memory areas
20538c2ecf20Sopenharmony_ciare actually shared.
20548c2ecf20Sopenharmony_ci
20558c2ecf20Sopenharmony_ci3.10	/proc/<pid>/timerslack_ns - Task timerslack value
20568c2ecf20Sopenharmony_ci---------------------------------------------------------
20578c2ecf20Sopenharmony_ciThis file provides the value of the task's timerslack value in nanoseconds.
20588c2ecf20Sopenharmony_ciThis value specifies an amount of time that normal timers may be deferred
20598c2ecf20Sopenharmony_ciin order to coalesce timers and avoid unnecessary wakeups.
20608c2ecf20Sopenharmony_ci
20618c2ecf20Sopenharmony_ciThis allows a task's interactivity vs power consumption tradeoff to be
20628c2ecf20Sopenharmony_ciadjusted.
20638c2ecf20Sopenharmony_ci
20648c2ecf20Sopenharmony_ciWriting 0 to the file will set the task's timerslack to the default value.
20658c2ecf20Sopenharmony_ci
20668c2ecf20Sopenharmony_ciValid values are from 0 - ULLONG_MAX
20678c2ecf20Sopenharmony_ci
20688c2ecf20Sopenharmony_ciAn application setting the value must have PTRACE_MODE_ATTACH_FSCREDS level
20698c2ecf20Sopenharmony_cipermissions on the task specified to change its timerslack_ns value.
20708c2ecf20Sopenharmony_ci
20718c2ecf20Sopenharmony_ci3.11	/proc/<pid>/patch_state - Livepatch patch operation state
20728c2ecf20Sopenharmony_ci-----------------------------------------------------------------
20738c2ecf20Sopenharmony_ciWhen CONFIG_LIVEPATCH is enabled, this file displays the value of the
20748c2ecf20Sopenharmony_cipatch state for the task.
20758c2ecf20Sopenharmony_ci
20768c2ecf20Sopenharmony_ciA value of '-1' indicates that no patch is in transition.
20778c2ecf20Sopenharmony_ci
20788c2ecf20Sopenharmony_ciA value of '0' indicates that a patch is in transition and the task is
20798c2ecf20Sopenharmony_ciunpatched.  If the patch is being enabled, then the task hasn't been
20808c2ecf20Sopenharmony_cipatched yet.  If the patch is being disabled, then the task has already
20818c2ecf20Sopenharmony_cibeen unpatched.
20828c2ecf20Sopenharmony_ci
20838c2ecf20Sopenharmony_ciA value of '1' indicates that a patch is in transition and the task is
20848c2ecf20Sopenharmony_cipatched.  If the patch is being enabled, then the task has already been
20858c2ecf20Sopenharmony_cipatched.  If the patch is being disabled, then the task hasn't been
20868c2ecf20Sopenharmony_ciunpatched yet.
20878c2ecf20Sopenharmony_ci
20888c2ecf20Sopenharmony_ci3.12 /proc/<pid>/arch_status - task architecture specific status
20898c2ecf20Sopenharmony_ci-------------------------------------------------------------------
20908c2ecf20Sopenharmony_ciWhen CONFIG_PROC_PID_ARCH_STATUS is enabled, this file displays the
20918c2ecf20Sopenharmony_ciarchitecture specific status of the task.
20928c2ecf20Sopenharmony_ci
20938c2ecf20Sopenharmony_ciExample
20948c2ecf20Sopenharmony_ci~~~~~~~
20958c2ecf20Sopenharmony_ci
20968c2ecf20Sopenharmony_ci::
20978c2ecf20Sopenharmony_ci
20988c2ecf20Sopenharmony_ci $ cat /proc/6753/arch_status
20998c2ecf20Sopenharmony_ci AVX512_elapsed_ms:      8
21008c2ecf20Sopenharmony_ci
21018c2ecf20Sopenharmony_ciDescription
21028c2ecf20Sopenharmony_ci~~~~~~~~~~~
21038c2ecf20Sopenharmony_ci
21048c2ecf20Sopenharmony_cix86 specific entries
21058c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~
21068c2ecf20Sopenharmony_ci
21078c2ecf20Sopenharmony_ciAVX512_elapsed_ms
21088c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^
21098c2ecf20Sopenharmony_ci
21108c2ecf20Sopenharmony_ci  If AVX512 is supported on the machine, this entry shows the milliseconds
21118c2ecf20Sopenharmony_ci  elapsed since the last time AVX512 usage was recorded. The recording
21128c2ecf20Sopenharmony_ci  happens on a best effort basis when a task is scheduled out. This means
21138c2ecf20Sopenharmony_ci  that the value depends on two factors:
21148c2ecf20Sopenharmony_ci
21158c2ecf20Sopenharmony_ci    1) The time which the task spent on the CPU without being scheduled
21168c2ecf20Sopenharmony_ci       out. With CPU isolation and a single runnable task this can take
21178c2ecf20Sopenharmony_ci       several seconds.
21188c2ecf20Sopenharmony_ci
21198c2ecf20Sopenharmony_ci    2) The time since the task was scheduled out last. Depending on the
21208c2ecf20Sopenharmony_ci       reason for being scheduled out (time slice exhausted, syscall ...)
21218c2ecf20Sopenharmony_ci       this can be arbitrary long time.
21228c2ecf20Sopenharmony_ci
21238c2ecf20Sopenharmony_ci  As a consequence the value cannot be considered precise and authoritative
21248c2ecf20Sopenharmony_ci  information. The application which uses this information has to be aware
21258c2ecf20Sopenharmony_ci  of the overall scenario on the system in order to determine whether a
21268c2ecf20Sopenharmony_ci  task is a real AVX512 user or not. Precise information can be obtained
21278c2ecf20Sopenharmony_ci  with performance counters.
21288c2ecf20Sopenharmony_ci
21298c2ecf20Sopenharmony_ci  A special value of '-1' indicates that no AVX512 usage was recorded, thus
21308c2ecf20Sopenharmony_ci  the task is unlikely an AVX512 user, but depends on the workload and the
21318c2ecf20Sopenharmony_ci  scheduling scenario, it also could be a false negative mentioned above.
21328c2ecf20Sopenharmony_ci
21338c2ecf20Sopenharmony_ciChapter 4: Configuring procfs
21348c2ecf20Sopenharmony_ci=============================
21358c2ecf20Sopenharmony_ci
21368c2ecf20Sopenharmony_ci4.1	Mount options
21378c2ecf20Sopenharmony_ci---------------------
21388c2ecf20Sopenharmony_ci
21398c2ecf20Sopenharmony_ciThe following mount options are supported:
21408c2ecf20Sopenharmony_ci
21418c2ecf20Sopenharmony_ci	=========	========================================================
21428c2ecf20Sopenharmony_ci	hidepid=	Set /proc/<pid>/ access mode.
21438c2ecf20Sopenharmony_ci	gid=		Set the group authorized to learn processes information.
21448c2ecf20Sopenharmony_ci	subset=		Show only the specified subset of procfs.
21458c2ecf20Sopenharmony_ci	=========	========================================================
21468c2ecf20Sopenharmony_ci
21478c2ecf20Sopenharmony_cihidepid=off or hidepid=0 means classic mode - everybody may access all
21488c2ecf20Sopenharmony_ci/proc/<pid>/ directories (default).
21498c2ecf20Sopenharmony_ci
21508c2ecf20Sopenharmony_cihidepid=noaccess or hidepid=1 means users may not access any /proc/<pid>/
21518c2ecf20Sopenharmony_cidirectories but their own.  Sensitive files like cmdline, sched*, status are now
21528c2ecf20Sopenharmony_ciprotected against other users.  This makes it impossible to learn whether any
21538c2ecf20Sopenharmony_ciuser runs specific program (given the program doesn't reveal itself by its
21548c2ecf20Sopenharmony_cibehaviour).  As an additional bonus, as /proc/<pid>/cmdline is unaccessible for
21558c2ecf20Sopenharmony_ciother users, poorly written programs passing sensitive information via program
21568c2ecf20Sopenharmony_ciarguments are now protected against local eavesdroppers.
21578c2ecf20Sopenharmony_ci
21588c2ecf20Sopenharmony_cihidepid=invisible or hidepid=2 means hidepid=1 plus all /proc/<pid>/ will be
21598c2ecf20Sopenharmony_cifully invisible to other users.  It doesn't mean that it hides a fact whether a
21608c2ecf20Sopenharmony_ciprocess with a specific pid value exists (it can be learned by other means, e.g.
21618c2ecf20Sopenharmony_ciby "kill -0 $PID"), but it hides process' uid and gid, which may be learned by
21628c2ecf20Sopenharmony_cistat()'ing /proc/<pid>/ otherwise.  It greatly complicates an intruder's task of
21638c2ecf20Sopenharmony_cigathering information about running processes, whether some daemon runs with
21648c2ecf20Sopenharmony_cielevated privileges, whether other user runs some sensitive program, whether
21658c2ecf20Sopenharmony_ciother users run any program at all, etc.
21668c2ecf20Sopenharmony_ci
21678c2ecf20Sopenharmony_cihidepid=ptraceable or hidepid=4 means that procfs should only contain
21688c2ecf20Sopenharmony_ci/proc/<pid>/ directories that the caller can ptrace.
21698c2ecf20Sopenharmony_ci
21708c2ecf20Sopenharmony_cigid= defines a group authorized to learn processes information otherwise
21718c2ecf20Sopenharmony_ciprohibited by hidepid=.  If you use some daemon like identd which needs to learn
21728c2ecf20Sopenharmony_ciinformation about processes information, just add identd to this group.
21738c2ecf20Sopenharmony_ci
21748c2ecf20Sopenharmony_cisubset=pid hides all top level files and directories in the procfs that
21758c2ecf20Sopenharmony_ciare not related to tasks.
21768c2ecf20Sopenharmony_ci
21778c2ecf20Sopenharmony_ciChapter 5: Filesystem behavior
21788c2ecf20Sopenharmony_ci==============================
21798c2ecf20Sopenharmony_ci
21808c2ecf20Sopenharmony_ciOriginally, before the advent of pid namepsace, procfs was a global file
21818c2ecf20Sopenharmony_cisystem. It means that there was only one procfs instance in the system.
21828c2ecf20Sopenharmony_ci
21838c2ecf20Sopenharmony_ciWhen pid namespace was added, a separate procfs instance was mounted in
21848c2ecf20Sopenharmony_cieach pid namespace. So, procfs mount options are global among all
21858c2ecf20Sopenharmony_cimountpoints within the same namespace::
21868c2ecf20Sopenharmony_ci
21878c2ecf20Sopenharmony_ci	# grep ^proc /proc/mounts
21888c2ecf20Sopenharmony_ci	proc /proc proc rw,relatime,hidepid=2 0 0
21898c2ecf20Sopenharmony_ci
21908c2ecf20Sopenharmony_ci	# strace -e mount mount -o hidepid=1 -t proc proc /tmp/proc
21918c2ecf20Sopenharmony_ci	mount("proc", "/tmp/proc", "proc", 0, "hidepid=1") = 0
21928c2ecf20Sopenharmony_ci	+++ exited with 0 +++
21938c2ecf20Sopenharmony_ci
21948c2ecf20Sopenharmony_ci	# grep ^proc /proc/mounts
21958c2ecf20Sopenharmony_ci	proc /proc proc rw,relatime,hidepid=2 0 0
21968c2ecf20Sopenharmony_ci	proc /tmp/proc proc rw,relatime,hidepid=2 0 0
21978c2ecf20Sopenharmony_ci
21988c2ecf20Sopenharmony_ciand only after remounting procfs mount options will change at all
21998c2ecf20Sopenharmony_cimountpoints::
22008c2ecf20Sopenharmony_ci
22018c2ecf20Sopenharmony_ci	# mount -o remount,hidepid=1 -t proc proc /tmp/proc
22028c2ecf20Sopenharmony_ci
22038c2ecf20Sopenharmony_ci	# grep ^proc /proc/mounts
22048c2ecf20Sopenharmony_ci	proc /proc proc rw,relatime,hidepid=1 0 0
22058c2ecf20Sopenharmony_ci	proc /tmp/proc proc rw,relatime,hidepid=1 0 0
22068c2ecf20Sopenharmony_ci
22078c2ecf20Sopenharmony_ciThis behavior is different from the behavior of other filesystems.
22088c2ecf20Sopenharmony_ci
22098c2ecf20Sopenharmony_ciThe new procfs behavior is more like other filesystems. Each procfs mount
22108c2ecf20Sopenharmony_cicreates a new procfs instance. Mount options affect own procfs instance.
22118c2ecf20Sopenharmony_ciIt means that it became possible to have several procfs instances
22128c2ecf20Sopenharmony_cidisplaying tasks with different filtering options in one pid namespace::
22138c2ecf20Sopenharmony_ci
22148c2ecf20Sopenharmony_ci	# mount -o hidepid=invisible -t proc proc /proc
22158c2ecf20Sopenharmony_ci	# mount -o hidepid=noaccess -t proc proc /tmp/proc
22168c2ecf20Sopenharmony_ci	# grep ^proc /proc/mounts
22178c2ecf20Sopenharmony_ci	proc /proc proc rw,relatime,hidepid=invisible 0 0
22188c2ecf20Sopenharmony_ci	proc /tmp/proc proc rw,relatime,hidepid=noaccess 0 0
2219