virtio-rng: fix excessive serialization with multiple consumers
Suppose N threads try to acquire a byte of entropy from an empty pool. They will all serialize on the mutex, waiting for the pool to refill. However, when the pool is eventually refilled, only one consumer will be awakened; the rest will continue sleeping even though there is entropy available in the pool. They will eventually be awakened when the worker refills the pool, but that's unneeded latency. Fix by using wake_all() to wake all consumers. Signed-off-by:Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment