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

Andrea Arcangeli (andrea@suse.de)
Thu, 6 Jan 2000 18:29:24 +0100 (CET)


On Thu, 6 Jan 2000, Richard B. Johnson wrote:

>Well it __is__ cached into registers on this compiler (2.7.2.3)!

When I said cached into registers I meant cached this way:

read into eax
inc eax
wait 1 year while doing other stuff
write eax into memory before return

And the above would be fine as well in the do_timer case.

> movl foo,%eax ! Get it
> leal 1(%eax),%edx ! bump it by one
> movl %edx,foo ! write it back

The above is perfect for a volatile variable IMHO. Also incl (without lock
on the bus) is not atomic in SMP.

Andrea

-
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/