From: Xingjun Liu xingjun.lxj@alibaba-inc.com
maillist inclusion category: performance bugzilla: https://gitee.com/openeuler/kernel/issues/I8K30G CVE: NA
Reference: https://gitee.com/openeuler/kernel/commit/ae624897ce3846524a3b0d3e525d8f8a8f...
---------------------------
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 Signed-off-by: Chen Jun chenjun102@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Chen Jun chenjun102@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Signed-off-by: GUO Zihua guozihua@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 3cb37760dfec..b9ae54c243a9 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1100,7 +1100,8 @@ void add_interrupt_randomness(int irq) if (new_count & MIX_INFLIGHT) return;
- if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ)) + if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ) && + crng_ready()) return;
fast_pool->count |= MIX_INFLIGHT;