From: Xingjun Liu xingjun.lxj@alibaba-inc.com
anolis inclusion from anolis_master commit 7afda44c8a9e043f8f16dcc57dd8ef615522e2c8 category: performance bugzilla: NA CVE: NA ---------------------------
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 xingjun.lxj@alibaba-inc.com Reviewed-by: Liu Jiang gerry@linux.alibaba.com Reviewed-by: Caspar Zhang caspar@linux.alibaba.com Reviewed-by: Jia Zhang zhang.jia@linux.alibaba.com Reviewed-by: Yang Shi yang.shi@linux.alibaba.com Reviewed-by: Liu Bo bo.liu@linux.alibaba.com Signed-off-by: Chen Jialong chenjialong@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Reviewed-by: Ziyuan Hu huziyuan@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- 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 347d9e1f65798..72d47ac06af97 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1274,7 +1274,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;
r = &input_pool;