[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200831031104.23322-3-richard.weiyang@linux.alibaba.com>
Date: Mon, 31 Aug 2020 11:11:00 +0800
From: Wei Yang <richard.weiyang@...ux.alibaba.com>
To: rostedt@...dmis.org, mingo@...hat.com
Cc: linux-kernel@...r.kernel.org,
Wei Yang <richard.weiyang@...ux.alibaba.com>
Subject: [PATCH 2/6] 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.
Signed-off-by: Wei Yang <richard.weiyang@...ux.alibaba.com>
---
kernel/trace/ftrace.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 12cb535769bc..9021e16fa079 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)
--
2.20.1 (Apple Git-117)
Powered by blists - more mailing lists