lkml.org 
[lkml]   [2003]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] (3/4) 2.5.59 fast reader/writer lock for gettimeofday
From
Date
This is the ia64 portion of lockless gettimeofday. It defines frlock
and changes locking of xtime_lock from rwlock to frlock.
diff -urN -X dontdiff linux-2.5.59/arch/ia64/kernel/time.c linux-2.5-frlock/arch/ia64/kernel/time.c
--- linux-2.5.59/arch/ia64/kernel/time.c 2003-01-17 09:42:15.000000000 -0800
+++ linux-2.5-frlock/arch/ia64/kernel/time.c 2003-01-24 14:54:11.000000000 -0800
@@ -24,7 +24,7 @@
#include <asm/sal.h>
#include <asm/system.h>

-extern rwlock_t xtime_lock;
+extern frlock_t xtime_lock;
extern unsigned long wall_jiffies;
extern unsigned long last_time_offset;

@@ -89,7 +89,7 @@
void
do_settimeofday (struct timeval *tv)
{
- write_lock_irq(&xtime_lock);
+ fr_write_lock_irq(&xtime_lock);
{
/*
* This is revolting. We need to set "xtime" correctly. However, the value
@@ -112,21 +112,21 @@
time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT;
}
- write_unlock_irq(&xtime_lock);
+ fr_write_unlock_irq(&xtime_lock);
}

void
do_gettimeofday (struct timeval *tv)
{
- unsigned long flags, usec, sec, old;
+ unsigned long seq, usec, sec, old;

- read_lock_irqsave(&xtime_lock, flags);
- {
+ do {
+ seq = fr_read_begin(&xtime_lock);
usec = gettimeoffset();

/*
- * Ensure time never goes backwards, even when ITC on different CPUs are
- * not perfectly synchronized.
+ * Ensure time never goes backwards, even when ITC on
+ * different CPUs are not perfectly synchronized.
*/
do {
old = last_time_offset;
@@ -138,8 +138,8 @@

sec = xtime.tv_sec;
usec += xtime.tv_nsec / 1000;
- }
- read_unlock_irqrestore(&xtime_lock, flags);
+ } while (seq != fr_read_end(&xtime_lock));
+

while (usec >= 1000000) {
usec -= 1000000;
@@ -182,10 +182,10 @@
* another CPU. We need to avoid to SMP race by acquiring the
* xtime_lock.
*/
- write_lock(&xtime_lock);
+ fr_write_lock(&xtime_lock);
do_timer(regs);
local_cpu_data->itm_next = new_itm;
- write_unlock(&xtime_lock);
+ fr_write_unlock(&xtime_lock);
} else
local_cpu_data->itm_next = new_itm;
\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.022 / U:31.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site