summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2017-03-01 09:21:10 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-03-01 09:59:27 +0100
commite53051e757d6cd66741955b93581e54415e48a70 (patch)
treeefe58f81dfd08a4bdf043436ddbcedd73a562c0e
parent3c915bdc1775acfa214195da1ffb39dabdd1a389 (diff)
downloadlinux-e53051e757d6cd66741955b93581e54415e48a70.tar.gz
linux-e53051e757d6cd66741955b93581e54415e48a70.tar.bz2
linux-e53051e757d6cd66741955b93581e54415e48a70.zip
s390/cputime: provide archicture specific cputime_to_nsecs
The generic cputime_to_nsecs function first converts the cputime to micro-seconds and then multiplies the result with 1000. This looses some bits of accuracy, provide our own version of cputime_to_nsecs that does not loose precision. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/cputime.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index e5672d6276a6..9072bf63a846 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -8,6 +8,7 @@
#define _S390_CPUTIME_H
#include <linux/types.h>
+#include <asm/timex.h>
#define CPUTIME_PER_USEC 4096ULL
#define CPUTIME_PER_SEC (CPUTIME_PER_USEC * USEC_PER_SEC)
@@ -17,13 +18,18 @@
#define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new)
/*
- * Convert cputime to microseconds and back.
+ * Convert cputime to microseconds.
*/
static inline u64 cputime_to_usecs(const u64 cputime)
{
return cputime >> 12;
}
+/*
+ * Convert cputime to nanoseconds.
+ */
+#define cputime_to_nsecs(cputime) tod_to_ns(cputime)
+
u64 arch_cpu_idle_time(int cpu);
#define arch_idle_time(cpu) arch_cpu_idle_time(cpu)