[linux-pm] [patch] Re: using long instead of atomic_t when only set/read is required

Alan Cox alan at lxorguk.ukuu.org.uk
Mon Mar 3 07:48:31 PST 2008


> Ok, so linux actually atomicity of long?

No it doesn't. And even if it did you couldn't use long for this because
atomic_t also ensures the points operations complete are defined. You
might just about get away with volatile long * objects on x86 for simple
assignments but for anything else gcc can and will generate code to
update values whichever way it feels best - which includes turning

	long *x = a + b;

into

	*x = a;
	*x += b;

Alan


More information about the linux-pm mailing list