On Thu, 6 Jan 2000, Andrea Arcangeli wrote:
> 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...
>
> No reason. It won't make any difference.
>
> You could as well do jiffies++. jiffies is volatile so it can't be
> reodered across other `;' and it won't be cached into registers.
>
[SNIPPED]
Well it __is__ cached into registers on this compiler (2.7.2.3)!
#include <stdio.h>
volatile long foo;
main()
{
foo++;
printf("%ld\n", foo);
}
.file "xxx.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.string "%ld\n"
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
movl foo,%eax ! Get it
leal 1(%eax),%edx ! bump it by one
movl %edx,foo ! write it back
movl foo,%eax ! Then do something dumb
movl foo,%edx ! Then do something dumb again
pushl %edx
pushl $.LC0
call printf
addl $8,%esp
.L1:
leave
ret
.Lfe1:
.size main,.Lfe1-main
.comm foo,4,4
.ident "GCC: (GNU) 2.7.2.3"
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