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

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu Jan 06 2000 - 09:49:20 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/



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