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

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

 



On Mon, 3 Mar 2008, Alan Cox wrote:

> > Atomicity of reads of write for pointers and integral types (other than 
> > long long) should be documented.
> 
> NAK.
> 
> Atomicity of reads or writes for pointers and integral types is NOT
> guaranteed. Gcc doesn't believe in your guarantee.

Miscommunication and lack of clarity.  CPU reads and writes _are_ 
guaranteed to be atomic.  What is not guaranteed is that the compiler 
will generate a single read or write instruction corresponding to a 
particular expression in C.

Consider a routine like the following:

	static task_struct *the_task;

	void store_task(void)
	{
		the_task = current;
	}

Is it possible to say whether readers examining "the_task" are 
guaranteed to see a coherent value?

Alan Stern		

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux