]> git.baikalelectronics.ru Git - kernel.git/commit
random: avoid reading two cache lines on irq randomness
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 22 Sep 2022 16:46:04 +0000 (18:46 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 28 Sep 2022 16:17:30 +0000 (18:17 +0200)
commitef60b00ee54a9cff39dda9281881fa132a446d38
treeee7e977c2029f6710aaaa2df9f5c7a4addc9f7b6
parent9cf56e5cebbaf6cb6c2c7c54ac41903ecc0152c1
random: avoid reading two cache lines on irq randomness

In order to avoid reading and dirtying two cache lines on every IRQ,
move the work_struct to the bottom of the fast_pool struct. add_
interrupt_randomness() always touches .pool and .count, which are
currently split, because .mix pushes everything down. Instead, move .mix
to the bottom, so that .pool and .count are always in the first cache
line, since .mix is only accessed when the pool is full.

Fixes: 59647cfb0716 ("random: defer fast pool mixing to worker")
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c