summaryrefslogtreecommitdiff
path: root/include/linux/jiffies.h
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2003-02-04 23:25:27 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2003-02-04 23:25:27 -0800
commitbb59cfa4c9113214f91fa0ce744fd92fe2745039 (patch)
tree392951d646a403765ff56681fa3a6f5ae99815ed /include/linux/jiffies.h
parent62672619d8b2203538f37c05ca167b9a8b3f94d4 (diff)
[PATCH] seqlock for xtime
Add "seqlock" infrastructure for doing low-overhead optimistic reader locks (writer increments a sequence number, reader verifies that no writers came in during the critical region, and lots of careful memory barriers to take care of business). Make xtime/get_jiffies_64() use this new locking.
Diffstat (limited to 'include/linux/jiffies.h')
-rw-r--r--include/linux/jiffies.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c81b51bab1e3..0a60a4f52077 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -3,6 +3,7 @@
#include <linux/types.h>
#include <linux/spinlock.h>
+#include <linux/seqlock.h>
#include <asm/system.h>
#include <asm/param.h> /* for HZ */
@@ -17,13 +18,15 @@ extern unsigned long volatile jiffies;
static inline u64 get_jiffies_64(void)
{
#if BITS_PER_LONG < 64
- extern rwlock_t xtime_lock;
- unsigned long flags;
+ extern seqlock_t xtime_lock;
+ unsigned long seq;
u64 tmp;
- read_lock_irqsave(&xtime_lock, flags);
- tmp = jiffies_64;
- read_unlock_irqrestore(&xtime_lock, flags);
+ do {
+ seq = read_seqbegin(&xtime_lock);
+ tmp = jiffies_64;
+ } while (read_seqretry(&xtime_lock, seq));
+
return tmp;
#else
return (u64)jiffies;