Re: (*(unsigned long *)&jiffies)++;

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu Jan 06 2000 - 13:08:33 EST


On Thu, 6 Jan 2000, Andrea Arcangeli wrote:

> On Thu, 6 Jan 2000, Richard B. Johnson wrote:
>
> >However, the C-code hack to force reordering is incorrect. It ties
>
> jiffies is volatile so the increment won't be reordered.
>
> And the only reason we make jiffies volatile is for the readers and _not_
> for the only writer (do_timer) we are discussing about. In do_timer
> there's no problem if the compiler reoder or cache jiffies in regs for
> some time.
>
> Andrea
>

Well anyway. If it was important, you could save a few instruction
cycles as:

static __inline__ void bump()
{
    __asm__ __volatile__( "incl jiffies\n");
}

Which translates to:
#APP
        incl jiffies
#NO_APP

There could be different macros for different CPU types. If it isn't
important, then the *((unsigned long *) &jiffies)++ code is not
important either and should be simply jiffies++ as the original
caller stated.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.35 on an i686 machine (400.59 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:06 EST