The
membarrier
system call provides a memory barrier, ensuring ordering between memory
accesses performed by different threads or processes within the same address
space.
The following values for
cmd
may be specified:
| MEMBARRIER_CMD_QUERY
|
| |
Query supported commands.
A bitmask of commands supported by the kernel is returned.
|
| MEMBARRIER_CMD_GLOBAL
|
| |
Issue a memory barrier for all threads from all processes.
|
| MEMBARRIER_CMD_SHARED
|
| |
This is an alias for
MEMBARRIER_CMD_GLOBAL.
|
| MEMBARRIER_CMD_GLOBAL_EXPEDITED
|
| |
Execute a memory barrier on all running threads of all processes registered
with
MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED.
|
| MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED
|
| |
Register the process to receive
MEMBARRIER_CMD_GLOBAL_EXPEDITED
memory barriers.
|
| MEMBARRIER_CMD_PRIVATE_EXPEDITED
|
| |
Execute a memory barrier on each running thread belonging to the same process
as the thread calling
membarrier.
|
| MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED
|
| |
Register the process to receive
MEMBARRIER_CMD_PRIVATE_EXPEDITED
memory barriers.
|
| MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE
|
| |
In addition to the guarantees provided by
MEMBARRIER_CMD_PRIVATE_EXPEDITED
it also executes machine-specific serialization instructions, which
ensures that all possible speculative and out-of-order activities on the target
CPU are fenced.
|
| MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE
|
| |
Register the process to receive
MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE
memory barriers.
|
The following
cmd
values are defined for source compatibility but are not yet supported:
MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ
|
| |
|
The
flags
argument must be 0.
The
cpu_id
argument is ignored.