Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _ASM_POWERPC_MEMBARRIER_H
0002 #define _ASM_POWERPC_MEMBARRIER_H
0003 
0004 static inline void membarrier_arch_switch_mm(struct mm_struct *prev,
0005                          struct mm_struct *next,
0006                          struct task_struct *tsk)
0007 {
0008     /*
0009      * Only need the full barrier when switching between processes.
0010      * Barrier when switching from kernel to userspace is not
0011      * required here, given that it is implied by mmdrop(). Barrier
0012      * when switching from userspace to kernel is not needed after
0013      * store to rq->curr.
0014      */
0015     if (IS_ENABLED(CONFIG_SMP) &&
0016         likely(!(atomic_read(&next->membarrier_state) &
0017              (MEMBARRIER_STATE_PRIVATE_EXPEDITED |
0018               MEMBARRIER_STATE_GLOBAL_EXPEDITED)) || !prev))
0019         return;
0020 
0021     /*
0022      * The membarrier system call requires a full memory barrier
0023      * after storing to rq->curr, before going back to user-space.
0024      */
0025     smp_mb();
0026 }
0027 
0028 #endif /* _ASM_POWERPC_MEMBARRIER_H */