Re: [PATCH] remove volatile from nmi.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, 14 Jul 2006, Linus Torvalds wrote:
> 
> Now, there is a "reason" we'd want "endflag" to either be volatile, or 
> have the "set_wmb()", and that is that the code is incorrect in the first 
> place. 

Btw, and this may just be me, but I personally don't much like the 
"set_wmb()" macro. I think it should be removed.

I don't think we actually use it anywhere, and the thing is, it's not 
really useful. It is basically _always_ equivalent to

	var = value;
	smp_wmb();

except I think some architectures could _in_theory_ make the assignment be 
a "store with release consistency". The only architecture where that might 
make sense that I can think of is Itanium, and even there the ia64 
set_wmb() macro doesn't actually do that.

Yeah, the

	endflag = 1;
	smp_wmb();

is a bit longer, but is actually easier to understand, I think.

I suspect "set_wmb()" was added just from an incorrect sense of 
consistency with "set_mb()" (which I don't particularly like either, but 
at least that one makes a difference on a real platform, ie on x86 that 
"set_mb()" ends up being implemented as a single "xchg" instruction).

			Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux