Re: [RFC/PATCH] doc: volatile considered evil

Johannes Stezenbach
2007-05-09T09:43:17Z

On Tue, May 08, 2007, Jonathan Corbet wrote:
>
> I just took a shot at turning this into something more like a normal
> document:
>
> http://lwn.net/Articles/233479/

I think the "jiffies variable is special" part misses the
"for stupid legacy reasons" explanation.

According to the other volatile rules one should use
something like that:

extern unsigned long __jiffies;
static inline unsigned long read_ulong(unsigned long *addr)
{
return *(volatile unsigned long *)addr;
}
static inline unsigned long get_jiffies(void)
{
return read_ulong(&__jiffies);
}

But of course changing all references to jiffies in the kernel would
be insane, thus jiffies is special "for stupid legacy reasons".

Right?

Johannes