[PATCH v1 1/4] sparc64: interface to get random tick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sometimes it is useful to use tick in hash calculations or backoff
randomization. get_rand_tick()  can be used for these purposes.

Signed-off-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
Signed-off-by: Bob Picco <bob.picco@xxxxxxxxxx>
---
 arch/sparc/include/asm/timer_64.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h
index 51bc3bc..aa28bb4 100644
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -94,4 +94,19 @@ static inline unsigned long get_tick(void)
 	return tick;
 }
 
+/* Quick way to get a tick value that can be used in hash calculations,
+ * random backoffs etc.
+ */
+static inline unsigned long get_rand_tick(void)
+{
+	unsigned long tick;
+
+	__asm__ __volatile__(
+	"	rd	%%tick, %0\n"
+	: "=r" (tick)
+	: /* No input */);
+
+	return tick;
+}
+
 #endif /* _SPARC64_TIMER_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux