summaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@linux.alibaba.com>2020-08-31 11:11:00 +0800
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-10-08 15:29:06 -0400
commit59e65b3358f44d4d0134eca3b6c269f359f21cd5 (patch)
treee874d9cc9d84a563d4dc87cfad0159c3796c71a3 /kernel/trace
parent8db4d6bfbbf9206567fd529dc73dc058b3929db0 (diff)
downloadlinux-59e65b3358f44d4d0134eca3b6c269f359f21cd5.tar.bz2
ftrace: Use fls() to get the bits for dup_hash()
The effect here is to get the number of bits, lets use fls() to do this job. Link: https://lkml.kernel.org/r/20200831031104.23322-3-richard.weiyang@linux.alibaba.com Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 123d520b9261..5633d37d8806 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1370,8 +1370,9 @@ static struct ftrace_hash *dup_hash(struct ftrace_hash *src, int size)
/*
* Make the hash size about 1/2 the # found
*/
- for (size /= 2; size; size >>= 1)
- bits++;
+ bits = fls(size);
+ if (bits)
+ bits--;
/* Don't allocate too much */
if (bits > FTRACE_HASH_MAX_BITS)