forked from Minki/linux
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>
This commit is contained in:
parent
8db4d6bfbb
commit
59e65b3358
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user