[PATCH 2/4] delayacct: add members to struct task_delay_info tosave max delays
From: Satoru Moriya
Date: Mon Nov 28 2011 - 17:46:11 EST
This patch adds members to struct task_delay_info and a parameter to
delayacct_end() and saves maximum values for IO/SWAP/RECLAIM delays.
Signed-off-by: Satoru Moriya <satoru.moriya@xxxxxxx>
---
include/linux/sched.h | 3 +++
kernel/delayacct.c | 13 +++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1665e2c..edd8ad2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -768,6 +768,8 @@ struct task_delay_info {
struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
u64 blkio_delay; /* wait for sync block io completion */
u64 swapin_delay; /* wait for swapin block io completion */
+ u64 blkio_delay_max; /* max wait for sync block io completion */
+ u64 swapin_delay_max; /* max wait for swapin block io completion */
u32 blkio_count; /* total count of the number of sync block */
/* io operations performed */
u32 swapin_count; /* total count of the number of swapin block */
@@ -775,6 +777,7 @@ struct task_delay_info {
struct timespec freepages_start, freepages_end;
u64 freepages_delay; /* wait for memory reclaim */
+ u64 freepages_delay_max;/* max wait for memory reclaim */
u32 freepages_count; /* total count of memory reclaim */
};
#endif /* CONFIG_TASK_DELAY_ACCT */
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 418b3f7..33d090b 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -61,7 +61,7 @@ static inline void delayacct_start(struct timespec *start)
*/
static void delayacct_end(struct timespec *start, struct timespec *end,
- u64 *total, u32 *count)
+ u64 *total, u32 *count, u64 *max)
{
struct timespec ts;
s64 ns;
@@ -76,6 +76,8 @@ static void delayacct_end(struct timespec *start, struct timespec *end,
spin_lock_irqsave(¤t->delays->lock, flags);
*total += ns;
(*count)++;
+ if (*max < ns)
+ *max = ns;
spin_unlock_irqrestore(¤t->delays->lock, flags);
}
@@ -91,12 +93,14 @@ void __delayacct_blkio_end(void)
delayacct_end(¤t->delays->blkio_start,
¤t->delays->blkio_end,
¤t->delays->swapin_delay,
- ¤t->delays->swapin_count);
+ ¤t->delays->swapin_count,
+ ¤t->delays->swapin_delay_max);
else /* Other block I/O */
delayacct_end(¤t->delays->blkio_start,
¤t->delays->blkio_end,
¤t->delays->blkio_delay,
- ¤t->delays->blkio_count);
+ ¤t->delays->blkio_count,
+ ¤t->delays->blkio_delay_max);
}
int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
@@ -181,6 +185,7 @@ void __delayacct_freepages_end(void)
delayacct_end(¤t->delays->freepages_start,
¤t->delays->freepages_end,
¤t->delays->freepages_delay,
- ¤t->delays->freepages_count);
+ ¤t->delays->freepages_count,
+ ¤t->delays->freepages_delay_max);
}
--
1.7.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/