]> www.infradead.org Git - users/dwmw2/linux.git/commit
random: move initialization out of reseeding hot path
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 9 May 2022 11:53:24 +0000 (13:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:24:07 +0000 (09:24 +0200)
commit4d77c5dc80264c0b9d9d4799d2afa8024e23a64f
treeae6500a1b70f7fe5c96131b5ecf14b1893bb4fe8
parente84123f90491618c6d0095495502e566bc5b41c4
random: move initialization out of reseeding hot path

commit 68c9c8b192c6dae9be6278e98ee44029d5da2d31 upstream.

Initialization happens once -- by way of credit_init_bits() -- and then
it never happens again. Therefore, it doesn't need to be in
crng_reseed(), which is a hot path that is called multiple times. It
also doesn't make sense to have there, as initialization activity is
better associated with initialization routines.

After the prior commit, crng_reseed() now won't be called by multiple
concurrent callers, which means that we can safely move the
"finialize_init" logic into crng_init_bits() unconditionally.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c