[MDEV-6693] Atomic operations with explicit memory barrier Created: 2014-09-04  Updated: 2014-10-21  Resolved: 2014-10-14

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.1.1

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6906 Relaxed memory order for counters Closed
relates to MDEV-6478 MariaDB on Power8 Closed

 Description   

Currently atomic operations create full memory barrier. This ensures correct program behavior. However weaker memory barriers have lower performance impact and there are many cases when weaker memory barrier is sufficient.

The idea of this task is to adopt C11 atomic API to some extent, so it is possible to specify memory barriers for atomic operations.

C11 atomic operations as such seem to be unavailable in many environments. E.g. they appeared only in gcc-4.9. MSVC doesn't seem to support them, same for Solaris Studio.

It is proposed to use gcc atomic builtins whenever they're available, otherwise fall back to atomic operations with implicit full memory barrier.



 Comments   
Comment by Sergey Vojtovich [ 2014-09-04 ]

Sergei, please review patch for this task. It is committed against 10.0, I will leave up to you to decide into which version it is supposed to be pushed to.

Comment by Sergei Golubchik [ 2014-10-14 ]

ok to push (in 10.1)

Comment by Sergey Vojtovich [ 2014-10-14 ]

Pushed to 10.1.1:

commit e813f9b9b3a087910b94ffeda968b53f9fca4311
Author: Sergey Vojtovich <svoj@mariadb.org>
Date:   Tue Oct 14 14:58:35 2014 +0400
 
    MDEV-6693 - Atomic operations with explicit memory barrier
 
    Added API for atomic operations with explicit memory barrier. Only gcc
    atomic builtins are currently supported. If they're unavailable, fall
    back to atomic operations with implicit full memory barrier.

Generated at Thu Feb 08 07:13:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.