1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * task_io_accounting: a structure which is used for recording a single task's 4*4882a593Smuzhiyun * IO statistics. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Don't include this header file directly - it is designed to be dragged in via 7*4882a593Smuzhiyun * sched.h. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * Blame Andrew Morton for all this. 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun struct task_io_accounting { 13*4882a593Smuzhiyun #ifdef CONFIG_TASK_XACCT 14*4882a593Smuzhiyun /* bytes read */ 15*4882a593Smuzhiyun u64 rchar; 16*4882a593Smuzhiyun /* bytes written */ 17*4882a593Smuzhiyun u64 wchar; 18*4882a593Smuzhiyun /* # of read syscalls */ 19*4882a593Smuzhiyun u64 syscr; 20*4882a593Smuzhiyun /* # of write syscalls */ 21*4882a593Smuzhiyun u64 syscw; 22*4882a593Smuzhiyun /* # of fsync syscalls */ 23*4882a593Smuzhiyun u64 syscfs; 24*4882a593Smuzhiyun #endif /* CONFIG_TASK_XACCT */ 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #ifdef CONFIG_TASK_IO_ACCOUNTING 27*4882a593Smuzhiyun /* 28*4882a593Smuzhiyun * The number of bytes which this task has caused to be read from 29*4882a593Smuzhiyun * storage. 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun u64 read_bytes; 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun /* 34*4882a593Smuzhiyun * The number of bytes which this task has caused, or shall cause to be 35*4882a593Smuzhiyun * written to disk. 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun u64 write_bytes; 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun /* 40*4882a593Smuzhiyun * A task can cause "negative" IO too. If this task truncates some 41*4882a593Smuzhiyun * dirty pagecache, some IO which another task has been accounted for 42*4882a593Smuzhiyun * (in its write_bytes) will not be happening. We _could_ just 43*4882a593Smuzhiyun * subtract that from the truncating task's write_bytes, but there is 44*4882a593Smuzhiyun * information loss in doing that. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun u64 cancelled_write_bytes; 47*4882a593Smuzhiyun #endif /* CONFIG_TASK_IO_ACCOUNTING */ 48*4882a593Smuzhiyun }; 49