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

From: Andrea Arcangeli (andrea@suse.de)
Date: Thu Jan 06 2000 - 11:42:14 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...

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.

The only "jiffies" writer is the timer irq handler that as an irq handler
is single threaded by the linux irq design. So there's no point at all to
even think about atomicity.
   
The lost_* stuff is protected by the xtime_lock spinlock and that's
unrelated stuff. "jiffies" locking and meaning have nothing to do with the
lost_* variables.

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