Re: How should we do a 64-bit jiffies?

From: Brian Gerst (bgerst@didntduck.org)
Date: Tue Oct 23 2001 - 01:05:54 EST


Keith Owens wrote:
>
> On Mon, 22 Oct 2001 08:12:24 -0700,
> george anzinger <george@mvista.com> wrote:
> >I am working on POSIX timers where there is defined a CLOCK_MONOTONIC.
> >The most reasonable implementation of this clock is that it is "uptime"
> >or jiffies. The problem is that it is most definitely not MONOTONIC
> >when it rolls back to 0 :( Thus the need for 64-bits.
>
> If you want to leave existing kernel code alone so it still uses 32 bit
> jiffies, just maintain a separate high order 32 bit field which is only
> used by the code that really needs it. On 32 bit machines, the jiffie
> code does
>
> old_jiffies = jiffies++;
> if (jiffies < old_jiffies)
> ++high_jiffies;
>
> You will need a spin lock around that on 32 bit systems, but that is
> true for anything that tries to do 64 bit counter updates on a 32 bit
> system. None of your suggestions will work on ix86, it does not
> support atomic updates on 64 bit fields in hardware.

cmpxchg8b does, but it's a bit indirect.

-- 

Brian Gerst - 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/



This archive was generated by hypermail 2b29 : Tue Oct 23 2001 - 21:00:35 EST