diff options
-rw-r--r-- | Documentation/filesystems/proc.txt | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 72af5de1effb..5484ab5efd4f 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -41,6 +41,7 @@ Table of Contents | |||
41 | 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem | 41 | 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem |
42 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score | 42 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score |
43 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score | 43 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score |
44 | 2.14 /proc/<pid>/io - Display the IO accounting fields | ||
44 | 45 | ||
45 | ------------------------------------------------------------------------------ | 46 | ------------------------------------------------------------------------------ |
46 | Preface | 47 | Preface |
@@ -1990,3 +1991,107 @@ need to recompile the kernel, or even to reboot the system. The files in the | |||
1990 | command to write value into these files, thereby changing the default settings | 1991 | command to write value into these files, thereby changing the default settings |
1991 | of the kernel. | 1992 | of the kernel. |
1992 | ------------------------------------------------------------------------------ | 1993 | ------------------------------------------------------------------------------ |
1994 | |||
1995 | 2.14 /proc/<pid>/io - Display the IO accounting fields | ||
1996 | ------------------------------------------------------- | ||
1997 | |||
1998 | This file contains IO statistics for each running process | ||
1999 | |||
2000 | Example | ||
2001 | ------- | ||
2002 | |||
2003 | test:/tmp # dd if=/dev/zero of=/tmp/test.dat & | ||
2004 | [1] 3828 | ||
2005 | |||
2006 | test:/tmp # cat /proc/3828/io | ||
2007 | rchar: 323934931 | ||
2008 | wchar: 323929600 | ||
2009 | syscr: 632687 | ||
2010 | syscw: 632675 | ||
2011 | read_bytes: 0 | ||
2012 | write_bytes: 323932160 | ||
2013 | cancelled_write_bytes: 0 | ||
2014 | |||
2015 | |||
2016 | Description | ||
2017 | ----------- | ||
2018 | |||
2019 | rchar | ||
2020 | ----- | ||
2021 | |||
2022 | I/O counter: chars read | ||
2023 | The number of bytes which this task has caused to be read from storage. This | ||
2024 | is simply the sum of bytes which this process passed to read() and pread(). | ||
2025 | It includes things like tty IO and it is unaffected by whether or not actual | ||
2026 | physical disk IO was required (the read might have been satisfied from | ||
2027 | pagecache) | ||
2028 | |||
2029 | |||
2030 | wchar | ||
2031 | ----- | ||
2032 | |||
2033 | I/O counter: chars written | ||
2034 | The number of bytes which this task has caused, or shall cause to be written | ||
2035 | to disk. Similar caveats apply here as with rchar. | ||
2036 | |||
2037 | |||
2038 | syscr | ||
2039 | ----- | ||
2040 | |||
2041 | I/O counter: read syscalls | ||
2042 | Attempt to count the number of read I/O operations, i.e. syscalls like read() | ||
2043 | and pread(). | ||
2044 | |||
2045 | |||
2046 | syscw | ||
2047 | ----- | ||
2048 | |||
2049 | I/O counter: write syscalls | ||
2050 | Attempt to count the number of write I/O operations, i.e. syscalls like | ||
2051 | write() and pwrite(). | ||
2052 | |||
2053 | |||
2054 | read_bytes | ||
2055 | ---------- | ||
2056 | |||
2057 | I/O counter: bytes read | ||
2058 | Attempt to count the number of bytes which this process really did cause to | ||
2059 | be fetched from the storage layer. Done at the submit_bio() level, so it is | ||
2060 | accurate for block-backed filesystems. <please add status regarding NFS and | ||
2061 | CIFS at a later time> | ||
2062 | |||
2063 | |||
2064 | write_bytes | ||
2065 | ----------- | ||
2066 | |||
2067 | I/O counter: bytes written | ||
2068 | Attempt to count the number of bytes which this process caused to be sent to | ||
2069 | the storage layer. This is done at page-dirtying time. | ||
2070 | |||
2071 | |||
2072 | cancelled_write_bytes | ||
2073 | --------------------- | ||
2074 | |||
2075 | The big inaccuracy here is truncate. If a process writes 1MB to a file and | ||
2076 | then deletes the file, it will in fact perform no writeout. But it will have | ||
2077 | been accounted as having caused 1MB of write. | ||
2078 | In other words: The number of bytes which this process caused to not happen, | ||
2079 | by truncating pagecache. A task can cause "negative" IO too. If this task | ||
2080 | truncates some dirty pagecache, some IO which another task has been accounted | ||
2081 | for (in it's write_bytes) will not be happening. We _could_ just subtract that | ||
2082 | from the truncating task's write_bytes, but there is information loss in doing | ||
2083 | that. | ||
2084 | |||
2085 | |||
2086 | Note | ||
2087 | ---- | ||
2088 | |||
2089 | At its current implementation state, this is a bit racy on 32-bit machines: if | ||
2090 | process A reads process B's /proc/pid/io while process B is updating one of | ||
2091 | those 64-bit counters, process A could see an intermediate result. | ||
2092 | |||
2093 | |||
2094 | More information about this can be found within the taskstats documentation in | ||
2095 | Documentation/accounting. | ||
2096 | |||
2097 | ------------------------------------------------------------------------------ | ||