Kernel Newbies Archive on lore.kernel.org
 help / color / Atom feed
* memory order seq cst for atomics
@ 2021-04-02 14:45 Navin P
  2021-04-02 15:09 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Navin P @ 2021-04-02 14:45 UTC (permalink / raw)
  To: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 156 bytes --]

Hi,
  C11 and c++11  have memory order like memory_order_seq_cst .What is the
equivalent in Linux kernel ?
atomic64_inc(&var) ;
__SMP_mb();

Regards,
Navin

[-- Attachment #1.2: Type: text/html, Size: 343 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: memory order seq cst for atomics
  2021-04-02 14:45 memory order seq cst for atomics Navin P
@ 2021-04-02 15:09 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-04-02 15:09 UTC (permalink / raw)
  To: Navin P; +Cc: kernelnewbies

On Fri, Apr 02, 2021 at 08:15:12PM +0530, Navin P wrote:
> Hi,
>   C11 and c++11  have memory order like memory_order_seq_cst .What is the
> equivalent in Linux kernel ?
> atomic64_inc(&var) ;
> __SMP_mb();

Please read Documentation/memory-barriers.txt in the kernel source tree.
It should answer all of your questions regarding this.

good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 14:45 memory order seq cst for atomics Navin P
2021-04-02 15:09 ` Greg KH

Kernel Newbies Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git