Re: [RFC PATCH for 4.14 1/2] membarrier: Remove unused code for architectures without membarrier hooks

From: Mathieu Desnoyers
Date: Fri Oct 06 2017 - 17:52:25 EST



----- On Oct 6, 2017, at 5:08 PM, Paul E. McKenney paulmck@xxxxxxxxxxxxxxxxxx wrote:

> 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 <npiggin@xxxxxxxxx>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
>
> Queued for further review and testing, targeting v4.15. Please let me
> know if you need it sooner.

Hi Paul,

Given that the following patch in this patchset (2/2)
"Fix: membarrier: Handle CLONE_VM + !CLONE_THREAD correctly on powerpc"
is based on this patch, and that the fix needs to go into 4.14,
I would recommend queuing both patches for 4.14 is possible.

Otherwise I could try swapping the order of the two patches if
needed, but since both are touching nearby code areas, rebasing
is not straightforward.

Thanks,

Mathieu

>
> Thanx, Paul
>
>> CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>> CC: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
>> CC: Boqun Feng <boqun.feng@xxxxxxxxx>
>> CC: Andrew Hunter <ahh@xxxxxxxxxx>
>> CC: Maged Michael <maged.michael@xxxxxxxxx>
>> CC: gromer@xxxxxxxxxx
>> CC: Avi Kivity <avi@xxxxxxxxxxxx>
>> CC: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
>> CC: Paul Mackerras <paulus@xxxxxxxxx>
>> CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
>> CC: Dave Watson <davejwatson@xxxxxx>
>> CC: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
>> CC: Will Deacon <will.deacon@xxxxxxx>
>> CC: Andy Lutomirski <luto@xxxxxxxxxx>
>> CC: Ingo Molnar <mingo@xxxxxxxxxx>
>> CC: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
>> CC: linuxppc-dev@xxxxxxxxxxxxxxxx
>> CC: linux-arch@xxxxxxxxxxxxxxx
>> ---
>> 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

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com