diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-09-29 12:49:35 +0300 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-09-29 22:37:27 +0300 |
commit | 4c95236a335d8b62aa8dbd587bed6a5f30d8265a (patch) | |
tree | 4333db791a8239ca83a9f2b3d7b3cfeadb07e6ee /drivers/char/random.c | |
parent | 585cd5fe9f7378601b1d4915ad6e9088333b5e5e (diff) | |
download | linux-4c95236a335d8b62aa8dbd587bed6a5f30d8265a.tar.xz |
prandom: make use of smaller types in prandom_u32_max
When possible at compile-time, make use of smaller types in
prandom_u32_max(), so that we can use smaller batches from random.c,
which in turn leads to a 2x or 4x performance boost. This makes a
difference, for example, in kfence, which needs a fast stream of small
numbers (booleans).
At the same time, we use the occasion to update the old documentation on
these functions. prandom_u32() and prandom_bytes() have direct
replacements now in random.h, while prandom_u32_max() remains useful as
a prandom.h function, since it's not cryptographically secure by virtue
of not being evenly distributed.
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'drivers/char/random.c')
0 files changed, 0 insertions, 0 deletions