Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] per-task-delay-accounting: /proc export of aggregated block I/O delays

Export I/O delays seen by a task through /proc/<tgid>/stats for use in top
etc.

Note that delays for I/O done for swapping in pages (swapin I/O) is clubbed
together with all other I/O here (this is not the case in the netlink
interface where the swapin I/O is kept distinct)

[akpm@osdl.org: printk warning fix]
Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
Signed-off-by: Balbir Singh <balbir@in.ibm.com>
Cc: Jes Sorensen <jes@sgi.com>
Cc: Peter Chubb <peterc@gelato.unsw.edu.au>
Cc: Erich Focht <efocht@ess.nec.de>
Cc: Levent Serinol <lserinol@gmail.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Shailabh Nagar and committed by
Linus Torvalds
25890454 a3baf649

+26 -2
+4 -2
fs/proc/array.c
··· 74 74 #include <linux/times.h> 75 75 #include <linux/cpuset.h> 76 76 #include <linux/rcupdate.h> 77 + #include <linux/delayacct.h> 77 78 78 79 #include <asm/uaccess.h> 79 80 #include <asm/pgtable.h> ··· 412 411 413 412 res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ 414 413 %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ 415 - %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n", 414 + %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %llu\n", 416 415 task->pid, 417 416 tcomm, 418 417 state, ··· 456 455 task->exit_signal, 457 456 task_cpu(task), 458 457 task->rt_priority, 459 - task->policy); 458 + task->policy, 459 + (unsigned long long)delayacct_blkio_ticks(task)); 460 460 if(mm) 461 461 mmput(mm); 462 462 return res;
+10
include/linux/delayacct.h
··· 37 37 extern void __delayacct_blkio_start(void); 38 38 extern void __delayacct_blkio_end(void); 39 39 extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); 40 + extern __u64 __delayacct_blkio_ticks(struct task_struct *); 40 41 41 42 static inline void delayacct_set_flag(int flag) 42 43 { ··· 87 86 return __delayacct_add_tsk(d, tsk); 88 87 } 89 88 89 + static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) 90 + { 91 + if (tsk->delays) 92 + return __delayacct_blkio_ticks(tsk); 93 + return 0; 94 + } 95 + 90 96 #else 91 97 static inline void delayacct_set_flag(int flag) 92 98 {} ··· 111 103 {} 112 104 static inline int delayacct_add_tsk(struct taskstats *d, 113 105 struct task_struct *tsk) 106 + { return 0; } 107 + static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) 114 108 { return 0; } 115 109 #endif /* CONFIG_TASK_DELAY_ACCT */ 116 110
+12
kernel/delayacct.c
··· 164 164 spin_unlock(&tsk->delays_lock); 165 165 return 0; 166 166 } 167 + 168 + __u64 __delayacct_blkio_ticks(struct task_struct *tsk) 169 + { 170 + __u64 ret; 171 + 172 + spin_lock(&tsk->delays->lock); 173 + ret = nsec_to_clock_t(tsk->delays->blkio_delay + 174 + tsk->delays->swapin_delay); 175 + spin_unlock(&tsk->delays->lock); 176 + return ret; 177 + } 178 +