On Thu, Oct 05, 2017 at 06:33:26PM -0400, Mathieu Desnoyers wrote:
> Architectures without membarrier hooks don't need to emit the
> empty membarrier_arch_switch_mm() static inline when
> CONFIG_MEMBARRIER=y.
>
> Adapt the CONFIG_MEMBARRIER=n counterpart to only emit the empty
> membarrier_arch_switch_mm() for architectures with membarrier hooks.
>
> Reported-by: Nicholas Piggin <[email protected]>
> Signed-off-by: Mathieu Desnoyers <[email protected]>
Queued for further review and testing, targeting v4.15. Please let me
know if you need it sooner.
Thanx, Paul
> CC: Peter Zijlstra <[email protected]>
> CC: Paul E. McKenney <[email protected]>
> CC: Boqun Feng <[email protected]>
> CC: Andrew Hunter <[email protected]>
> CC: Maged Michael <[email protected]>
> CC: [email protected]
> CC: Avi Kivity <[email protected]>
> CC: Benjamin Herrenschmidt <[email protected]>
> CC: Paul Mackerras <[email protected]>
> CC: Michael Ellerman <[email protected]>
> CC: Dave Watson <[email protected]>
> CC: Alan Stern <[email protected]>
> CC: Will Deacon <[email protected]>
> CC: Andy Lutomirski <[email protected]>
> CC: Ingo Molnar <[email protected]>
> CC: Alexander Viro <[email protected]>
> CC: [email protected]
> CC: [email protected]
> ---
> include/linux/sched/mm.h | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
> index d5a9ab8f3836..b2767ecb21a8 100644
> --- a/include/linux/sched/mm.h
> +++ b/include/linux/sched/mm.h
> @@ -215,10 +215,6 @@ static inline void memalloc_noreclaim_restore(unsigned
> int flags)
> #ifdef CONFIG_ARCH_HAS_MEMBARRIER_HOOKS
> #include <asm/membarrier.h>
> #else
> -static inline void membarrier_arch_switch_mm(struct mm_struct *prev,
> - struct mm_struct *next, struct task_struct *tsk)
> -{
> -}
> static inline void membarrier_arch_fork(struct task_struct *t,
> unsigned long clone_flags)
> {
> @@ -247,10 +243,12 @@ static inline void membarrier_execve(struct task_struct
> *t)
> membarrier_arch_execve(t);
> }
> #else
> +#ifdef CONFIG_ARCH_HAS_MEMBARRIER_HOOKS
> static inline void membarrier_arch_switch_mm(struct mm_struct *prev,
> struct mm_struct *next, struct task_struct *tsk)
> {
> }
> +#endif
> static inline void membarrier_fork(struct task_struct *t,
> unsigned long clone_flags)
> {
> --
> 2.11.0
>