From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Juri Lelli <juri.lelli@redhat.com>,
Andy Lutomirski <luto@amacapital.net>,
Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Borislav Petkov <bp@alien8.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 10/15] sched/headers: Standardize kernel/sched/sched.h header dependencies
Date: Tue, 15 Mar 2022 09:42:42 +0100 [thread overview]
Message-ID: <20220315084247.40783-11-mingo@kernel.org> (raw)
In-Reply-To: <20220315084247.40783-1-mingo@kernel.org>
kernel/sched/sched.h is a weird mix of ad-hoc headers included
in the middle of the header.
Two of them rely on being included in the middle of kernel/sched/sched.h,
due to definitions they require:
- "stat.h" needs the rq definitions.
- "autogroup.h" needs the task_group definition.
Move the inclusion of these two files out of kernel/sched/sched.h, and
include them in all files that require them.
Move of the rest of the header dependencies to the top of the
kernel/sched/sched.h file.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Peter Zijlstra <peterz@infradead.org>
---
kernel/sched/build_policy.c | 3 +++
kernel/sched/build_utility.c | 2 ++
kernel/sched/core.c | 2 ++
kernel/sched/fair.c | 2 ++
kernel/sched/sched.h | 20 +++++++++++---------
kernel/sched/stats.h | 4 ++--
6 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/build_policy.c b/kernel/sched/build_policy.c
index 6bb384ddcfab..9a169b2f97e6 100644
--- a/kernel/sched/build_policy.c
+++ b/kernel/sched/build_policy.c
@@ -13,6 +13,9 @@
*/
#include "sched.h"
+
+#include "autogroup.h"
+#include "stats.h"
#include "pelt.h"
#include "idle.c"
diff --git a/kernel/sched/build_utility.c b/kernel/sched/build_utility.c
index 31216ce0b4b3..8b2b199983bf 100644
--- a/kernel/sched/build_utility.c
+++ b/kernel/sched/build_utility.c
@@ -12,6 +12,8 @@
#include "sched.h"
#include "sched-pelt.h"
+#include "stats.h"
+#include "autogroup.h"
#include <linux/sched_clock.h>
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ef946123e9af..22de53710ee9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -11,6 +11,8 @@
#undef CREATE_TRACE_POINTS
#include "sched.h"
+#include "stats.h"
+#include "autogroup.h"
#include <linux/nospec.h>
#include <linux/blkdev.h>
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 16874e112fe6..7391c9287503 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -21,6 +21,8 @@
* Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
*/
#include "sched.h"
+#include "stats.h"
+#include "autogroup.h"
/*
* Targeted preemption latency for CPU-bound tasks:
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index f7d10b98e911..f255ec2afeca 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -96,11 +96,20 @@
# include <asm/paravirt.h>
#endif
+#include <trace/events/sched.h>
+
+#ifdef CONFIG_CGROUP_SCHED
+#include <linux/cgroup.h>
+#include <linux/psi.h>
+#endif
+
+#ifdef CONFIG_SCHED_DEBUG
+# include <linux/static_key.h>
+#endif
+
#include "cpupri.h"
#include "cpudeadline.h"
-#include <trace/events/sched.h>
-
#ifdef CONFIG_SCHED_DEBUG
# define SCHED_WARN_ON(x) WARN_ONCE(x, #x)
#else
@@ -417,9 +426,6 @@ extern bool dl_cpu_busy(unsigned int cpu);
#ifdef CONFIG_CGROUP_SCHED
-#include <linux/cgroup.h>
-#include <linux/psi.h>
-
struct cfs_rq;
struct rt_rq;
@@ -1919,9 +1925,6 @@ extern void flush_smp_call_function_from_idle(void);
static inline void flush_smp_call_function_from_idle(void) { }
#endif
-#include "stats.h"
-#include "autogroup.h"
-
#if defined(CONFIG_SCHED_CORE) && defined(CONFIG_SCHEDSTATS)
extern void __sched_core_account_forceidle(struct rq *rq);
@@ -2016,7 +2019,6 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
* Tunables that become constants when CONFIG_SCHED_DEBUG is off:
*/
#ifdef CONFIG_SCHED_DEBUG
-# include <linux/static_key.h>
# define const_debug __read_mostly
#else
# define const_debug const
diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
index edc0d13fc61b..a0df79e6038c 100644
--- a/kernel/sched/stats.h
+++ b/kernel/sched/stats.h
@@ -2,10 +2,10 @@
#ifndef _KERNEL_STATS_H
#define _KERNEL_STATS_H
-#ifdef CONFIG_SCHEDSTATS
-
#include "sched.h"
+#ifdef CONFIG_SCHEDSTATS
+
extern struct static_key_false sched_schedstats;
/*
--
2.32.0
next prev parent reply other threads:[~2022-03-15 8:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 8:42 [PATCH 00/15] sched/headers: Optimize scheduler build time Ingo Molnar
2022-03-15 8:42 ` [PATCH 01/15] sched/headers: Fix header to build standalone: <linux/sched_clock.h> Ingo Molnar
2022-03-15 8:42 ` [PATCH 02/15] sched/headers: Add header guard to kernel/sched/sched.h Ingo Molnar
2022-03-15 8:42 ` [PATCH 03/15] sched/headers: Add header guard to kernel/sched/stats.h and kernel/sched/autogroup.h Ingo Molnar
2022-03-15 8:42 ` [PATCH 04/15] sched/headers: sched/clock: Mark all functions 'notrace', remove CC_FLAGS_FTRACE build asymmetry Ingo Molnar
2022-03-15 8:42 ` [PATCH 05/15] sched/headers: Add initial new headers as identity mappings Ingo Molnar
2022-03-15 8:42 ` [PATCH 06/15] sched/headers: Fix comment typo in kernel/sched/cpudeadline.c Ingo Molnar
2022-03-15 8:42 ` [PATCH 07/15] sched/headers: Make the <linux/sched/deadline.h> header build standalone Ingo Molnar
2022-03-15 8:42 ` [PATCH 08/15] sched/headers: Introduce kernel/sched/build_utility.c and build multiple .c files there Ingo Molnar
2022-03-15 8:42 ` [PATCH 09/15] sched/headers: Introduce kernel/sched/build_policy.c " Ingo Molnar
2022-08-23 7:47 ` suhui_kernel
2022-08-24 15:50 ` Thomas Gleixner
2022-03-15 8:42 ` Ingo Molnar [this message]
2022-03-15 8:42 ` [PATCH 11/15] sched/headers: Reorganize, clean up and optimize kernel/sched/core.c dependencies Ingo Molnar
2022-03-15 8:42 ` [PATCH 12/15] sched/headers: Reorganize, clean up and optimize kernel/sched/fair.c dependencies Ingo Molnar
2022-03-15 8:42 ` [PATCH 13/15] sched/headers: Reorganize, clean up and optimize kernel/sched/build_policy.c dependencies Ingo Molnar
2022-03-15 8:42 ` [PATCH 14/15] sched/headers: Reorganize, clean up and optimize kernel/sched/build_utility.c dependencies Ingo Molnar
2022-03-15 8:42 ` [PATCH 15/15] sched/headers: Reorganize, clean up and optimize kernel/sched/sched.h dependencies Ingo Molnar
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=20220315084247.40783-11-mingo@kernel.org \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mgorman@suse.de \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.