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

Richard B. Johnson (root@chaos.analogic.com)
Thu, 6 Jan 2000 09:49:20 -0500 (EST)


On Thu, 6 Jan 2000, Tigran Aivazian wrote:

> Hi,
>
> Why does do_timer() do:
>
> (*(unsigned long *)&jiffies)++;
>
> why not just jiffies++; ? It works fine with jiffies++ but I assume there
> is a reason...
>
> Thanks,
> Tigran.
>

It looks to me like there was an attempt to prevent the 'C' compiler
from doing:

movl jiffies, %eax ! Read
incl %eax ! Modify
movl %eax, jiffies ! Write back

....and such attempts are rarely sucessful.

Ideally, you'd want:
incl jiffies

...and you'd have to do it in assembly to make sure the next 'C' compiler
doesn't out-guess you.

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/