Hi Michael, On Fri, 25 Oct 2024 11:29:38 +1100 Michael Ellerman <m...@ellerman.id.au> wrote: > > > diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h > > index 07bb8d4181d7..042e60ab853a 100644 > > --- a/include/linux/sched/mm.h > > +++ b/include/linux/sched/mm.h > > @@ -540,6 +540,8 @@ enum { > > > > static inline void membarrier_mm_sync_core_before_usermode(struct > > mm_struct *mm) > > { > > + if (!IS_ENABLED(CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE)) > > + return; > > if (current->mm != mm) > > return; > > if (likely(!(atomic_read(&mm->membarrier_state) & > > The other option would be to have a completely separate stub, eg: > > #ifdef CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE > static inline void membarrier_mm_sync_core_before_usermode(struct mm_struct > *mm) > { > if (current->mm != mm) > return; > if (likely(!(atomic_read(&mm->membarrier_state) & > MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE))) > return; > sync_core_before_usermode(); > } > #else > static inline void membarrier_mm_sync_core_before_usermode(struct mm_struct > *mm) { } > #endif > > Not sure what folks prefer.
I case it matters, in general I prefer the first as there is less code to get out of sync and all the code still gets parsed by the compiler whether the CONFIG option is set or not. -- Cheers, Stephen Rothwell
pgpHS2Z3sH1_D.pgp
Description: OpenPGP digital signature