From e10645331fc18947407247c9a31f91affa6e831b Mon Sep 17 00:00:00 2001 From: Xingjun Liu Date: Wed, 26 Jun 2019 14:45:04 +0800 Subject: [PATCH] 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 6d127c5029c9..193a76d66a38 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) { -- GitLab