Commit 59e65b33 authored by Wei Yang's avatar Wei Yang Committed by Steven Rostedt (VMware)

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.comSigned-off-by: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 8db4d6bf
...@@ -1370,8 +1370,9 @@ static struct ftrace_hash *dup_hash(struct ftrace_hash *src, int size) ...@@ -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 * Make the hash size about 1/2 the # found
*/ */
for (size /= 2; size; size >>= 1) bits = fls(size);
bits++; if (bits)
bits--;
/* Don't allocate too much */ /* Don't allocate too much */
if (bits > FTRACE_HASH_MAX_BITS) if (bits > FTRACE_HASH_MAX_BITS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment