Hi, On Mon, May 16, 2011 at 3:03 PM, <Valdis.Kletnieks@xxxxxx> wrote: > On Fri, 13 May 2011 10:09:09 +0200, Jean-Christophe PLAGNIOL-VILLARD said: >> On 10:52 Mon 09 May , Michal Marek wrote: >> > Do you have proof of concept patches that make use of the >> > config_is_xxx macros? Acked by the respective subsystem maintainers? >> > It would be a good idea to send them along to show that this feature >> > is going to be actually used. >> I've seen thousands of place in the kernel we can use >> so I'll just take one example on x86 >> >> the patch attached is just an example > > Out of curiosity, will this Do The Right Thing for cases where things simply won't > build for some configs? For example, consider this code snippet from kernel/timer.c, > in __mod_timer() (near line 682): > > debug_activate(timer, expires); > > cpu = smp_processor_id(); > > #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) > if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) > cpu = get_nohz_timer_target(); > #endif > new_base = per_cpu(tvec_bases, cpu); > > If you convert this to an if statement, will it still compile? Which will > happen first, dead code elimination, or the warning that get_nohz_timer_target() > is an implicit declaration because the definition in the .h file is also > guarded by #ifdef CONFIG_NO_HZ? > I already exposed this case, but let's prove it: % grep CONFIG_SMP .config # CONFIG_SMP is not set % git diff diff --git a/kernel/timer.c b/kernel/timer.c index fd61986..ea4a5ba 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -681,10 +681,8 @@ __mod_timer(struct timer_list *timer, unsigned long expires, cpu = smp_processor_id(); -#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) - if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) + if (0 && 0 && !pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) cpu = get_nohz_timer_target(); -#endif new_base = per_cpu(tvec_bases, cpu); % gmake kernel/timer.o CHK include/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CC kernel/timer.o kernel/timer.c: In function '__mod_timer': kernel/timer.c:685:3: error: implicit declaration of function 'get_nohz_timer_target' gmake[1]: *** [kernel/timer.o] Error 1 gmake: *** [kernel/timer.o] Error 2 - Arnaud -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html