[Top] [All Lists]

Re: jiffies_64 vs. jiffies

Subject: Re: jiffies_64 vs. jiffies
From: Atsushi Nemoto <>
Date: Wed, 01 Mar 2006 21:05:41 +0900 (JST)
In-reply-to: <>
Original-recipient: rfc822;
References: <>
>>>>> On Wed, 01 Mar 2006 14:44:42 +0900 (JST), Atsushi Nemoto 
>>>>> <> said:
anemo> Hi.  I noticed that the 'jiffies' variable has 'wall_jiffies +
anemo> 1' value in most of time.  I'm using MIPS platform but I think
anemo> this is same for other platforms.

anemo> I suppose this is due to gcc does not know that jiffies_64 and
anemo> jiffies share same place.
anemo> Is this really expected code?  If no, how it can be fixed?
anemo> Insert "barrier()" right after "jiffies_64++" ?

I suppose passing updated jiffies to update_times() would be more
efficient than barrier().  Here is a patch.

Pass updated jiffies to update_times() to avoid jiffies/jiffies_64

Signed-off-by: Atsushi Nemoto <>

diff --git a/kernel/timer.c b/kernel/timer.c
index fe3a9a9..7734788 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -904,11 +904,11 @@ void run_local_timers(void)
  * Called by the timer interrupt. xtime_lock must already be taken
  * by the timer IRQ!
-static inline void update_times(void)
+static inline void update_times(unsigned long jif)
        unsigned long ticks;
-       ticks = jiffies - wall_jiffies;
+       ticks = jif - wall_jiffies;
        if (ticks) {
                wall_jiffies += ticks;
@@ -924,8 +924,7 @@ static inline void update_times(void)
 void do_timer(struct pt_regs *regs)
-       jiffies_64++;
-       update_times();
+       update_times(++jiffies_64);
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>