tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cprng_fast implementation benchmarks

Manuel Bouyer <> 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:

#define cprng_getctx()  percpu_getref(percpu_cprng_fast_ctx)
#define cprng_putctx()  percpu_putref(percpu_cprng_fast_ctx)
static cprng_fast_ctx_t cprng_global_ctx;
#define cprng_getctx()  (&cprng_global_ctx)
#define cprng_putctx()

Not sure if it is worth, though.


Home | Main Index | Thread Index | Old Index