linux memory barriers associated

linux system, compiler or processor will optimize the code, will lead to the implementation of the code running on the same CPU / thread order changes, can cause some oops occurs when the code before and after the strong dependence of execution.

The solution: increase the memory barrier. This ensures that the code before the memory barrier to the implementation of the (same CPU / on the thread) in code memory barrier. So the kernel to make sure the timing of the code, to add memory barrier to ensure.

function:

Function name Features
smp_mb () Suitable for multi-processor memory barriers
smp_rmb () For multi-processor read memory barrier
smp_wmb () For multi-processor write memory barrier

Reference blog:

https://blog.csdn.net/xuchenhuics/article/details/78255633

https://blog.csdn.net/u012630961/article/details/80974857

Guess you like

Origin blog.csdn.net/xuhao07/article/details/93898905