[lkml]   [2000]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: (*(unsigned long *)&jiffies)++;
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.

Well it __is__ cached into registers on this compiler (!

#include <stdio.h>
volatile long foo;
printf("%ld\n", foo);

.file "xxx.c"
.version "01.01"
.section .rodata
.string "%ld\n"
.align 4
.globl main
.type main,@function
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
.size main,.Lfe1-main
.comm foo,4,4
.ident "GCC: (GNU)"

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
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:55    [W:0.102 / U:0.368 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site