diff options
-rw-r--r-- | fs/proc/array.c | 6 | ||||
-rw-r--r-- | include/linux/delayacct.h | 10 | ||||
-rw-r--r-- | kernel/delayacct.c | 12 |
3 files changed, 26 insertions, 2 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 7495d3e20775..0b615d62a159 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/times.h> | 74 | #include <linux/times.h> |
75 | #include <linux/cpuset.h> | 75 | #include <linux/cpuset.h> |
76 | #include <linux/rcupdate.h> | 76 | #include <linux/rcupdate.h> |
77 | #include <linux/delayacct.h> | ||
77 | 78 | ||
78 | #include <asm/uaccess.h> | 79 | #include <asm/uaccess.h> |
79 | #include <asm/pgtable.h> | 80 | #include <asm/pgtable.h> |
@@ -411,7 +412,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
411 | 412 | ||
412 | res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ | 413 | res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ |
413 | %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ | 414 | %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ |
414 | %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n", | 415 | %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %llu\n", |
415 | task->pid, | 416 | task->pid, |
416 | tcomm, | 417 | tcomm, |
417 | state, | 418 | state, |
@@ -455,7 +456,8 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
455 | task->exit_signal, | 456 | task->exit_signal, |
456 | task_cpu(task), | 457 | task_cpu(task), |
457 | task->rt_priority, | 458 | task->rt_priority, |
458 | task->policy); | 459 | task->policy, |
460 | (unsigned long long)delayacct_blkio_ticks(task)); | ||
459 | if(mm) | 461 | if(mm) |
460 | mmput(mm); | 462 | mmput(mm); |
461 | return res; | 463 | return res; |
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h index d955078a1441..7e8b6011b8f3 100644 --- a/include/linux/delayacct.h +++ b/include/linux/delayacct.h | |||
@@ -37,6 +37,7 @@ extern void __delayacct_tsk_exit(struct task_struct *); | |||
37 | extern void __delayacct_blkio_start(void); | 37 | extern void __delayacct_blkio_start(void); |
38 | extern void __delayacct_blkio_end(void); | 38 | extern void __delayacct_blkio_end(void); |
39 | extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); | 39 | extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); |
40 | extern __u64 __delayacct_blkio_ticks(struct task_struct *); | ||
40 | 41 | ||
41 | static inline void delayacct_set_flag(int flag) | 42 | static inline void delayacct_set_flag(int flag) |
42 | { | 43 | { |
@@ -86,6 +87,13 @@ static inline int delayacct_add_tsk(struct taskstats *d, | |||
86 | return __delayacct_add_tsk(d, tsk); | 87 | return __delayacct_add_tsk(d, tsk); |
87 | } | 88 | } |
88 | 89 | ||
90 | static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) | ||
91 | { | ||
92 | if (tsk->delays) | ||
93 | return __delayacct_blkio_ticks(tsk); | ||
94 | return 0; | ||
95 | } | ||
96 | |||
89 | #else | 97 | #else |
90 | static inline void delayacct_set_flag(int flag) | 98 | static inline void delayacct_set_flag(int flag) |
91 | {} | 99 | {} |
@@ -104,6 +112,8 @@ static inline void delayacct_blkio_end(void) | |||
104 | static inline int delayacct_add_tsk(struct taskstats *d, | 112 | static inline int delayacct_add_tsk(struct taskstats *d, |
105 | struct task_struct *tsk) | 113 | struct task_struct *tsk) |
106 | { return 0; } | 114 | { return 0; } |
115 | static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) | ||
116 | { return 0; } | ||
107 | #endif /* CONFIG_TASK_DELAY_ACCT */ | 117 | #endif /* CONFIG_TASK_DELAY_ACCT */ |
108 | 118 | ||
109 | #endif | 119 | #endif |
diff --git a/kernel/delayacct.c b/kernel/delayacct.c index 1be274a462ca..f05392d64267 100644 --- a/kernel/delayacct.c +++ b/kernel/delayacct.c | |||
@@ -164,3 +164,15 @@ done: | |||
164 | spin_unlock(&tsk->delays_lock); | 164 | spin_unlock(&tsk->delays_lock); |
165 | return 0; | 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 | |||