Re: Linux 2.6.25-rc2
From: Ingo Molnar
Date: Thu Feb 28 2008 - 03:15:40 EST
* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > incrementing the variable with a "++" when interrupts are not
> > > disabled. It's not an atomic add and it's racy. The code within
> > > stat() does exactly this.
> >
> > Yes but that is only for used for statistics which can be racy. Note
> > that the VM event statistics also can be racy.
>
> Doing ++ on a u32 _is_ atomic wrt interrupts on x86 and probably lots
> of other architectures, so we're OK using unsigned there. [...]
hm, why should it be atomic wrt. irqs? There's nothing that keeps gcc
from not doing an "incl memory_address" but do something like: "load
memory address into regx, incl regx, ... store address into memory
address" - and that's not atomic at that point.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/