[PATCH] Documentation for io-accounting / reporting via procfs

Add some documentation for the new and very useful io-accounting feature.
It's being added to Documentation/filesystems/proc.txt

Signed-off-by: Roland Kletzing <devzero@web.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Roland Kletzing and committed by Linus Torvalds f9c99463 721c04c6

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