Re: [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)

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

 



On 7/30/06, Atsushi Nemoto <[email protected]> wrote:
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7a9b182..298027f 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -423,7 +423,8 @@ #endif

        if (lost > 0) {
                handle_lost_ticks(lost, regs);
-               jiffies += lost;
+               while (lost--)
+                       do_timer(regs);
        }

 /*

I think that this is going into the wrong direction. There are a
number of architectures that call do_timer(regs) in a while loop. It
would be much nicer if do_timer would get the number of passed ticks
as an argument. And the "regs" argument to do_timer is just useless.

diff --git a/kernel/timer.c b/kernel/timer.c
index 05809c2..3981cae 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1267,12 +1267,9 @@ void run_local_timers(void)
  */
 static inline void update_times(void)
 {
-       unsigned long ticks;
-
-       ticks = jiffies - wall_jiffies;
-       wall_jiffies += ticks;
+       wall_jiffies++;
        update_wall_time();
-       calc_load(ticks);
+       calc_load(1);
 }

 /*

Pass "ticks" from do_timer and do "wall_jiffies += ticks". To make
calc_load work correctly the  "if (count < 0)" in calc_load needs to
be replaced with "while (count < 0)".

@@ -1284,8 +1281,6 @@ static inline void update_times(void)
 void do_timer(struct pt_regs *regs)
 {
        jiffies_64++;
-       /* prevent loading jiffies before storing new jiffies_64 value. */
-       barrier();
        update_times();
 }


Change do_timer and make architectures to pass "ticks", do "jiffies64
+= ticks" and add ticks to the call of update_times.

--
blue skies,
 Martin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux