lkml.org 
[lkml]   [2006]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
On 7/30/06, Atsushi Nemoto <anemo@mba.ocn.ne.jp> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-31 12:39    [W:0.079 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site