membarrier() System Call¶
MEMBARRIER_CMD_{PRIVATE,GLOBAL}_EXPEDITED - Architecture requirements¶
Memory barriers before updating rq->curr¶
The commands MEMBARRIER_CMD_PRIVATE_EXPEDITED and MEMBARRIER_CMD_GLOBAL_EXPEDITEDrequire each architecture to have a full memory barrier after coming fromuser-space, before updating rq->curr. This barrier is implied by the sequencerq_lock();smp_mb__after_spinlock() in__schedule(). The barrier matches a fullbarrier in the proximity of the membarrier system call exit, cf.membarrier_{private,global}_expedited().
Memory barriers after updating rq->curr¶
The commands MEMBARRIER_CMD_PRIVATE_EXPEDITED and MEMBARRIER_CMD_GLOBAL_EXPEDITEDrequire each architecture to have a full memory barrier after updating rq->curr,before returning to user-space. The schemes providing this barrier on the variousarchitectures are as follows.
alpha, arc, arm, hexagon, mips rely on the full barrier implied by
spin_unlock()infinish_lock_switch().arm64 relies on the full barrier implied by
switch_to().powerpc, riscv, s390, sparc, x86 rely on the full barrier implied by
switch_mm(), if mm is not NULL; they rely on the full barrier impliedbymmdrop(), otherwise. On powerpc and riscv,switch_mm()relies onmembarrier_arch_switch_mm().
The barrier matches a full barrier in the proximity of the membarrier system callentry, cf. membarrier_{private,global}_expedited().