membarrier.h 877 B

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