[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200911282035.26847.rusty@rustcorp.com.au>
Date: Sat, 28 Nov 2009 20:35:26 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Matt Mackall <mpm@...enic.com>
Cc: Ian Molton <ian.molton@...labora.co.uk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hw_random: core updates to allow more efficient drivers
On Thu, 26 Nov 2009 11:33:23 am Matt Mackall wrote:
> On Thu, 2009-11-26 at 00:25 +0000, Ian Molton wrote:
> > #define PFX RNG_MODULE_NAME ": "
> > #define RNG_MISCDEV_MINOR 183 /* official */
> > +#define RNG_BUFFSIZE 64
>
> How about just:
>
> static u8 rng_buffer[RNG_BUFFSIZE] __cacheline_aligned;
>
> And lose all the kmalloc and kfree code? The memory use will be smaller,
> even when the buffer isn't needed.
And might as well just #defube RNG_BUFFSIZE SMP_CACHE_BYTES (or use
SMP_CACHE_BYTES here and sizeof() elsewhere).
> > + if (!data_avail) {
> > + bytes_read = rng_get_data(current_rng, rng_buffer,
> > + RNG_BUFFSIZE, !(filp->f_flags & O_NONBLOCK));
>
> No need to pass rng_buffer to the helper as there's only one with global
> scope.
Naah, I like the separation; it matches the rest of the kernel and means we
can get funky with buffer management in 10 years time when we rewrite this
again.
Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists