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

From: Andrea Arcangeli (andrea@suse.de)
Date: Thu Jan 06 2000 - 12:37:25 EST


On Thu, 6 Jan 2000, Tigran Aivazian wrote:

>is because I suspected that some buggy versions of gcc ignore or mishandle
>it (and some people seem to confirm that, if you read this thread).

The below kind of increment is fine for a volatile variable. It's at least
what I expect the compiler doing for me.

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

>atomic_t jiffies). Therefore, the more economical way of writing is
>jiffies++;

Yes, more economical way for eyes.

>does not matter. Both are declared as volatile and yet jiffies were

lost_ticks_system is _not_ declared as volatile. And lost_ticks doesn't
need to be declared volatile as well, but not declaring it volatile won't
make any difference looking how it's used.

Only jiffies needs to be declared volatile because of free readers.

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/



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