summaryrefslogtreecommitdiffstats
path: root/kernel/delayacct.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 21:04:35 +0000
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 10:18:06 -0700
commit9667a23db0dc0bd4892f0ada7e4e71528eaeed62 (patch)
tree412d0676a0157467442c4d02e646f8272ccd620e /kernel/delayacct.c
parentccbf62d8a284cf181ac28c8e8407dd077d90dd4b (diff)
downloadtalos-obmc-linux-9667a23db0dc0bd4892f0ada7e4e71528eaeed62.tar.gz
talos-obmc-linux-9667a23db0dc0bd4892f0ada7e4e71528eaeed62.zip
delayacct: Make accounting nanosecond based
Kill the timespec juggling and calculate with plain nanoseconds. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/delayacct.c')
-rw-r--r--kernel/delayacct.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index de699f42f9bc..cf2e65dddb19 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -46,32 +46,25 @@ void __delayacct_tsk_init(struct task_struct *tsk)
}
/*
- * Finish delay accounting for a statistic using
- * its timestamps (@start, @end), accumalator (@total) and @count
+ * Finish delay accounting for a statistic using its timestamps (@start),
+ * accumalator (@total) and @count
*/
-
-static void delayacct_end(struct timespec *start, struct timespec *end,
- u64 *total, u32 *count)
+static void delayacct_end(u64 *start, u64 *total, u32 *count)
{
- struct timespec ts;
- s64 ns;
+ s64 ns = ktime_get_ns() - *start;
unsigned long flags;
- ktime_get_ts(end);
- ts = timespec_sub(*end, *start);
- ns = timespec_to_ns(&ts);
- if (ns < 0)
- return;
-
- spin_lock_irqsave(&current->delays->lock, flags);
- *total += ns;
- (*count)++;
- spin_unlock_irqrestore(&current->delays->lock, flags);
+ if (ns > 0) {
+ spin_lock_irqsave(&current->delays->lock, flags);
+ *total += ns;
+ (*count)++;
+ spin_unlock_irqrestore(&current->delays->lock, flags);
+ }
}
void __delayacct_blkio_start(void)
{
- ktime_get_ts(&current->delays->blkio_start);
+ current->delays->blkio_start = ktime_get_ns();
}
void __delayacct_blkio_end(void)
@@ -79,12 +72,10 @@ void __delayacct_blkio_end(void)
if (current->delays->flags & DELAYACCT_PF_SWAPIN)
/* Swapin block I/O */
delayacct_end(&current->delays->blkio_start,
- &current->delays->blkio_end,
&current->delays->swapin_delay,
&current->delays->swapin_count);
else /* Other block I/O */
delayacct_end(&current->delays->blkio_start,
- &current->delays->blkio_end,
&current->delays->blkio_delay,
&current->delays->blkio_count);
}
@@ -159,13 +150,12 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk)
void __delayacct_freepages_start(void)
{
- ktime_get_ts(&current->delays->freepages_start);
+ current->delays->freepages_start = ktime_get_ns();
}
void __delayacct_freepages_end(void)
{
delayacct_end(&current->delays->freepages_start,
- &current->delays->freepages_end,
&current->delays->freepages_delay,
&current->delays->freepages_count);
}
OpenPOWER on IntegriCloud