From 7afda44c8a9e043f8f16dcc57dd8ef615522e2c8 Mon Sep 17 00:00:00 2001 From: Xingjun Liu Date: Wed, 26 Jun 2019 14:45:04 +0800 Subject: [PATCH 0065/2944] alinux: random: speed up the initialization of module During the module initialization phase, entropy will be added to entropy pool for every interrupt, the change should speed up initialization of the random module. Before optimization: [ 22.180236] random: crng init done After optimization: [ 1.474832] random: crng init done Signed-off-by: Xingjun Liu Reviewed-by: Liu Jiang Reviewed-by: Caspar Zhang Reviewed-by: Jia Zhang Reviewed-by: Yang Shi Reviewed-by: Liu Bo --- drivers/char/random.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 9add8f4..d6a96e8 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1306,7 +1306,8 @@ void add_interrupt_randomness(int irq, int irq_flags) } if ((fast_pool->count < 64) && - !time_after(now, fast_pool->last + HZ)) + !time_after(now, fast_pool->last + HZ) && + crng_ready()) return; if (!seed_inited) { -- 1.8.3.1