• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ASM_POWERPC_MEMBARRIER_H
2 #define _ASM_POWERPC_MEMBARRIER_H
3 
membarrier_arch_switch_mm(struct mm_struct * prev,struct mm_struct * next,struct task_struct * tsk)4 static inline void membarrier_arch_switch_mm(struct mm_struct *prev,
5 					     struct mm_struct *next,
6 					     struct task_struct *tsk)
7 {
8 	/*
9 	 * Only need the full barrier when switching between processes.
10 	 * Barrier when switching from kernel to userspace is not
11 	 * required here, given that it is implied by mmdrop(). Barrier
12 	 * when switching from userspace to kernel is not needed after
13 	 * store to rq->curr.
14 	 */
15 	if (likely(!(atomic_read(&next->membarrier_state) &
16 		     (MEMBARRIER_STATE_PRIVATE_EXPEDITED |
17 		      MEMBARRIER_STATE_GLOBAL_EXPEDITED)) || !prev))
18 		return;
19 
20 	/*
21 	 * The membarrier system call requires a full memory barrier
22 	 * after storing to rq->curr, before going back to user-space.
23 	 */
24 	smp_mb();
25 }
26 
27 #endif /* _ASM_POWERPC_MEMBARRIER_H */
28