lkml.org 
[lkml]   [2001]   [Nov]   [1]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 01 Nov 2001 03:21:25 -0800
Fromgeorge anzinger <>
SubjectRe: [Patch] Re: Nasty suprise with uptime
Tim Schmielau wrote:
~snip
> @@ -683,6 +683,34 @@
>         if (TQ_ACTIVE(tq_timer))
>                 mark_bh(TQUEUE_BH);
>  }
> +
> +
> +#if BITS_PER_LONG < 48
> +
> +u64 get_jiffies64(void)
> +{
> +       static unsigned long jiffies_hi = 0;
> +       static unsigned long jiffies_last = INITIAL_JIFFIES;
> +       unsigned long jiffies_tmp;
> +
> +       jiffies_tmp = jiffies;   /* avoid races */
> +       if (jiffies_tmp < jiffies_last)   /* We have a wrap */
> +               jiffies_hi++;
> +       jiffies_last = jiffies_tmp;
> +
> +       return (jiffies_tmp | ((u64)jiffies_hi) << BITS_PER_LONG);

Doesn't this need to be protected on SMP machines?  What if two cpus
call get_jiffies64() at the same time...  Seems like jiffies_hi could
get bumped twice instead of once.

George
-
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: 2005-03-22 12:12    [W:0.450 / U:0.190 seconds]
©2003-2008 Jasper Spaans