psoda...@codeaurora.org writes: > On 2020-05-06 06:28, Thomas Gleixner wrote: >>> #ifdef CONFIG_SMP >>> +struct timer_base timer_base_deferrable; >>> unsigned int sysctl_timer_migration = 1; >>> >>> DEFINE_STATIC_KEY_FALSE(timers_migration_enabled); >>> @@ -841,8 +842,14 @@ static inline struct timer_base >>> *get_timer_cpu_base(u32 tflags, u32 cpu) >>> * If the timer is deferrable and NO_HZ_COMMON is set then we need >>> * to use the deferrable base. >>> */ >>> - if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) >>> - base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); >>> + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) >>> { >>> +#ifdef CONFIG_SMP >>> + base = &timer_base_deferrable; >>> +#endif >> >> There are definitely smarter ways of solving this than sprinkling >> #ifdef's around the code. > > I am able to understand all other comments and I will address all those > comments in the next patch set. > It is not clear to me how to avoid #ifdef's in this case. Could you > please share an example here?
The answer is further down already: >> Stub functions exist to avoid this unreadable #ifdef garbage.