aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorJason A. Donenfeld <[email protected]>2022-05-03 15:30:45 +0200
committerJason A. Donenfeld <[email protected]>2022-05-19 16:54:10 +0200
commitf5bda35fba615ace70a656d4700423fa6c9bebee (patch)
treea4f1f7267646d1c170f57c5c6e91bb1e65afdce7 /tools/perf/scripts/python
parent12e45a2a6308105469968951e6d563e8f4fea187 (diff)
random: use static branch for crng_ready()
Since crng_ready() is only false briefly during initialization and then forever after becomes true, we don't need to evaluate it after, making it a prime candidate for a static branch. One complication, however, is that it changes state in a particular call to credit_init_bits(), which might be made from atomic context, which means we must kick off a workqueue to change the static key. Further complicating things, credit_init_bits() may be called sufficiently early on in system initialization such that system_wq is NULL. Fortunately, there exists the nice function execute_in_process_context(), which will immediately execute the function if !in_interrupt(), and otherwise defer it to a workqueue. During early init, before workqueues are available, in_interrupt() is always false, because interrupts haven't even been enabled yet, which means the function in that case executes immediately. Later on, after workqueues are available, in_interrupt() might be true, but in that case, the work is queued in system_wq and all goes well. Cc: Theodore Ts'o <[email protected]> Cc: Sultan Alsawaf <[email protected]> Reviewed-by: Dominik Brodowski <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions