summaryrefslogtreecommitdiffstats
path: root/lib/random32.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2020-08-13 19:06:43 +0200
committerDavid S. Miller <davem@davemloft.net>2020-08-14 00:11:14 +0200
commit94c7eb54c4b8e81618ec79f414fe1ca5767f9720 (patch)
tree448b3fe1a37f74eb9308781e1957e557d18afb3d /lib/random32.c
parentRevert "ipv4: tunnel: fix compilation on ARCH=um" (diff)
downloadlinux-94c7eb54c4b8e81618ec79f414fe1ca5767f9720.tar.xz
linux-94c7eb54c4b8e81618ec79f414fe1ca5767f9720.zip
random32: add a tracepoint for prandom_u32()
There has been some heat around prandom_u32() lately, and some people were wondering if there was a simple way to determine how often it was used, before considering making it maybe 10 times more expensive. This tracepoint exports the generated pseudo random value. Tested: perf list | grep prandom_u32 random:prandom_u32 [Tracepoint event] perf record -a [-g] [-C1] -e random:prandom_u32 sleep 1 [ perf record: Woken up 0 times to write data ] [ perf record: Captured and wrote 259.748 MB perf.data (924087 samples) ] perf report --nochildren ... 97.67% ksoftirqd/1 [kernel.vmlinux] [k] prandom_u32 | ---prandom_u32 prandom_u32 | |--48.86%--tcp_v4_syn_recv_sock | tcp_check_req | tcp_v4_rcv | ... --48.81%--tcp_conn_request tcp_v4_conn_request tcp_rcv_state_process ... perf script Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willy Tarreau <w@1wt.eu> Cc: Sedat Dilek <sedat.dilek@gmail.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--lib/random32.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/random32.c b/lib/random32.c
index 3d749abb9e80..932345323af0 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -39,6 +39,7 @@
#include <linux/random.h>
#include <linux/sched.h>
#include <asm/unaligned.h>
+#include <trace/events/random.h>
#ifdef CONFIG_RANDOM32_SELFTEST
static void __init prandom_state_selftest(void);
@@ -82,6 +83,7 @@ u32 prandom_u32(void)
u32 res;
res = prandom_u32_state(state);
+ trace_prandom_u32(res);
put_cpu_var(net_rand_state);
return res;