[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240528005648.182376-3-yury.norov@gmail.com>
Date: Mon, 27 May 2024 17:56:44 -0700
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org,
linux-mm@...ck.org,
rcu@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Cc: Yury Norov <yury.norov@...il.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Amit Daniel Kachhap <amit.kachhap@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>,
Christoph Lameter <cl@...ux.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Dennis Zhou <dennis@...nel.org>,
Frederic Weisbecker <frederic@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Juri Lelli <juri.lelli@...hat.com>,
Kees Cook <keescook@...omium.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ulf Hansson <ulf.hansson@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Zefan Li <lizefan.x@...edance.com>
Subject: [PATCH 2/6] sched: avoid using ilog2() in sched.h
<linux/sched.h> indirectly via cpumask.h path includes the ilog2.h header
to calculate ilog2(TASK_REPORT_MAX). The following patches drops sched.h
dependency on cpumask.h, and to have a successful build, the header has
to be included explicitly.
sched.h is a frequently included header, and it's better to keep the
dependency list as small as possible. So, instead of including ilog2.h
for a single BUILD_BUG_ON() check, the same check may be implemented by
taking exponent of the other part of equation.
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
include/linux/sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 61591ac6eab6..98abb07de149 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1604,7 +1604,7 @@ static inline char task_index_to_char(unsigned int state)
{
static const char state_char[] = "RSDTtXZPI";
- BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != sizeof(state_char) - 1);
+ BUILD_BUG_ON(TASK_REPORT_MAX * 2 != 1 << (sizeof(state_char) - 1));
return state_char[state];
}
--
2.40.1
Powered by blists - more mailing lists