Manuel Bouyer <bou...@antioche.eu.org> wrote: > On Wed, Apr 23, 2014 at 09:16:33AM -0400, Thor Lancelot Simon wrote: > > [...] > > Do we still have a compile-time way to check if the kernel (or port) is > > uniprocessor only? If so we should probably #ifdef away the percpu > > calls in such kernels, which are probably for slower hardware anyway. > > AFAIK options MULTIPROCESSOR is still here >
It is, but it should generally be avoided, unless the optimisation is really significant. Also, make it least invasive, e.g. instead of #ifdef in a function body, do something like: #ifdef MULTIPROCESSOR #define cprng_getctx() percpu_getref(percpu_cprng_fast_ctx) #define cprng_putctx() percpu_putref(percpu_cprng_fast_ctx) #else static cprng_fast_ctx_t cprng_global_ctx; #define cprng_getctx() (&cprng_global_ctx) #define cprng_putctx() #endif Not sure if it is worth, though. -- Mindaugas