]> git.baikalelectronics.ru Git - kernel.git/commit
rcu-tasks: Use order_base_2() instead of ilog2()
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 2 Feb 2022 23:42:36 +0000 (15:42 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 8 Feb 2022 18:13:12 +0000 (10:13 -0800)
commit8cad11ed45dfbd8217afc1842961c9180d7c1e37
tree22b3902e5c6535584432304cb9d20dafe27853f9
parentcbf2592bb06f94f80f5a748b8150969d2bea4774
rcu-tasks: Use order_base_2() instead of ilog2()

The ilog2() function can be used to generate a shift count, but it will
generate the same count for a power of two as for one greater than a power
of two.  This results in shift counts that are larger than necessary for
systems with a power-of-two number of CPUs because the CPUs are numbered
from zero, so that the maximum CPU number is one less than that power
of two.

This commit therefore substitutes order_base_2(), which appears to have
been designed for exactly this use case.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tasks.h