From: Yury Norov <yury.norov@gmail.com>
To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
linux-mm@kvack.org, rcu@vger.kernel.org,
linux-trace-kernel@vger.kernel.org
Cc: Yury Norov <yury.norov@gmail.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Amit Daniel Kachhap <amit.kachhap@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Christoph Lameter <cl@linux.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Dennis Zhou <dennis@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Juri Lelli <juri.lelli@redhat.com>,
Kees Cook <keescook@chromium.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Tejun Heo <tj@kernel.org>, Thomas Gleixner <tglx@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Zefan Li <lizefan.x@bytedance.com>
Subject: [PATCH 2/6] sched: avoid using ilog2() in sched.h
Date: Mon, 27 May 2024 17:56:44 -0700 [thread overview]
Message-ID: <20240528005648.182376-3-yury.norov@gmail.com> (raw)
In-Reply-To: <20240528005648.182376-1-yury.norov@gmail.com>
<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@gmail.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
next prev parent reply other threads:[~2024-05-28 0:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 0:56 [PATCH 0/6] Cleanup cpumask.h inclusion in core headers Yury Norov
2024-05-28 0:56 ` [PATCH 1/6] MAINTAINERS: add linux/nodemask_types.h to BITMAP API Yury Norov
2024-05-28 0:56 ` Yury Norov [this message]
2024-05-28 0:56 ` [PATCH 3/6] cpumask: split out include/linux/cpumask_types.h Yury Norov
2024-05-28 0:56 ` [PATCH 4/6] sched: drop sched.h dependency on cpumask Yury Norov
2024-05-28 0:56 ` [PATCH 5/6] cpumask: cleanup core headers inclusion Yury Norov
2024-05-28 0:56 ` [PATCH 6/6] cpumask: make core headers including cpumask_types.h where possible Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240528005648.182376-3-yury.norov@gmail.com \
--to=yury.norov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=amit.kachhap@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=cl@linux.com \
--cc=daniel.lezcano@linaro.org \
--cc=dennis@kernel.org \
--cc=frederic@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lizefan.x@bytedance.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).