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

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: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 8db4d6bf
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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)