[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1259197403.2858.88.camel@calx>
Date: Wed, 25 Nov 2009 19:03:23 -0600
From: Matt Mackall <mpm@...enic.com>
To: Ian Molton <ian.molton@...labora.co.uk>
Cc: rusty@...tcorp.com.au, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hw_random: core updates to allow more efficient
drivers
On Thu, 2009-11-26 at 00:25 +0000, Ian Molton wrote:
> This patch implements a new method by which hw_random hardware drivers
> can pass data to the core more efficiently, using a shared buffer.
>
> The old methods have been retained as a compatability layer until all the
> drivers have been updated.
>
> Signed-off-by: Ian Molton <ian.molton@...labora.co.uk>
> ---
> drivers/char/hw_random/core.c | 120 ++++++++++++++++++++++++++---------------
> include/linux/hw_random.h | 9 ++-
> 2 files changed, 82 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index 1573aeb..e179afd 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -47,12 +47,14 @@
> #define RNG_MODULE_NAME "hw_random"
> #define PFX RNG_MODULE_NAME ": "
> #define RNG_MISCDEV_MINOR 183 /* official */
> +#define RNG_BUFFSIZE 64
>
>
> static struct hwrng *current_rng;
> static LIST_HEAD(rng_list);
> static DEFINE_MUTEX(rng_mutex);
> -
> +static u8 *rng_buffer;
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.
> + 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.
--
http://selenic.com : development and support for Mercurial and Linux
--
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