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 09/15] sched/headers: Introduce kernel/sched/build_policy.c and build multiple .c files there
Date: Tue, 15 Mar 2022 09:42:41 +0100 [thread overview]
Message-ID: <20220315084247.40783-10-mingo@kernel.org> (raw)
In-Reply-To: <20220315084247.40783-1-mingo@kernel.org>
Similarly to kernel/sched/build_utility.c, collect all 'scheduling policy' related
source code files into kernel/sched/build_policy.c:
kernel/sched/idle.c
kernel/sched/rt.c
kernel/sched/cpudeadline.c
kernel/sched/pelt.c
kernel/sched/cputime.c
kernel/sched/deadline.c
With the exception of fair.c, which we continue to build as a separate file
for build efficiency and parallelism reasons.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Peter Zijlstra <peterz@infradead.org>
---
kernel/sched/Makefile | 2 +-
kernel/sched/build_policy.c | 29 +++++++++++++++++++++++++++++
kernel/sched/cpudeadline.c | 1 -
kernel/sched/cputime.c | 1 -
kernel/sched/deadline.c | 2 --
kernel/sched/idle.c | 3 ---
kernel/sched/pelt.c | 4 ----
kernel/sched/rt.c | 3 ---
kernel/sched/sched.h | 8 ++++++++
9 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 4a4785cb3cd2..976092b7bd45 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -30,5 +30,5 @@ endif
#
obj-y += core.o
obj-y += fair.o
+obj-y += build_policy.o
obj-y += build_utility.o
-obj-y += idle.o rt.o deadline.o cputime.o cpudeadline.o pelt.o
diff --git a/kernel/sched/build_policy.c b/kernel/sched/build_policy.c
new file mode 100644
index 000000000000..6bb384ddcfab
--- /dev/null
+++ b/kernel/sched/build_policy.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * These are the scheduling policy related scheduler files, built
+ * in a single compilation unit for build efficiency reasons.
+ *
+ * ( Incidentally, the size of the compilation unit is roughly
+ * comparable to core.c and fair.c, the other two big
+ * compilation units. This helps balance build time, while
+ * coalescing source files to amortize header inclusion
+ * cost. )
+ *
+ * core.c and fair.c are built separately.
+ */
+
+#include "sched.h"
+#include "pelt.h"
+
+#include "idle.c"
+
+#include "rt.c"
+
+#ifdef CONFIG_SMP
+# include "cpudeadline.c"
+# include "pelt.c"
+#endif
+
+#include "cputime.c"
+#include "deadline.c"
+
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 0e196f0de492..02d970a879ed 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -6,7 +6,6 @@
*
* Author: Juri Lelli <j.lelli@sssup.it>
*/
-#include "sched.h"
static inline int parent(int i)
{
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index b7ec42732b28..78a233d43757 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -2,7 +2,6 @@
/*
* Simple CPU accounting cgroup controller
*/
-#include "sched.h"
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index d2c072b0ef01..fca2d7de4d3d 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -15,8 +15,6 @@
* Michael Trimarchi <michael@amarulasolutions.com>,
* Fabio Checconi <fchecconi@gmail.com>
*/
-#include "sched.h"
-#include "pelt.h"
struct dl_bandwidth def_dl_bandwidth;
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index d17b0a5ce6ac..8f8b5020e76a 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -6,9 +6,6 @@
* (NOTE: these are not related to SCHED_IDLE batch scheduled
* tasks which are handled in sched/fair.c )
*/
-#include "sched.h"
-
-#include <trace/events/power.h>
/* Linker adds these: start and end of __cpuidle functions */
extern char __cpuidle_text_start[], __cpuidle_text_end[];
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index a554e3bbab2b..0f310768260c 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -24,10 +24,6 @@
* Author: Vincent Guittot <vincent.guittot@linaro.org>
*/
-#include <linux/sched.h>
-#include "sched.h"
-#include "pelt.h"
-
/*
* Approximate:
* val * y^n, where y^32 ~= 0.5 (~1 scheduling period)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7b4f4fbbb404..ff4c044aed12 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -3,9 +3,6 @@
* Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR
* policies)
*/
-#include "sched.h"
-
-#include "pelt.h"
int sched_rr_timeslice = RR_TIMESLICE;
int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 79c7a8a2be65..f7d10b98e911 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -13,6 +13,7 @@
#include <linux/prctl.h>
#include <linux/ptrace_api.h>
#include <linux/gfp_api.h>
+#include <linux/posix-timers.h>
#include <linux/sched/clock.h>
#include <linux/workqueue_api.h>
#include <linux/tick.h>
@@ -113,8 +114,11 @@
#include <linux/cpumask_api.h>
#include <linux/ctype.h>
#include <linux/file.h>
+#include <linux/hrtimer_api.h>
+#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/kref_api.h>
+#include <linux/ktime_api.h>
#include <linux/lockdep_api.h>
#include <linux/module.h>
#include <linux/mutex_api.h>
@@ -126,12 +130,16 @@
#include <linux/sched/loadavg.h>
#include <linux/sched/mm.h>
#include <linux/sched/rseq_api.h>
+#include <linux/sched/signal.h>
#include <linux/seq_file.h>
#include <linux/seqlock.h>
+#include <linux/softirq.h>
+#include <linux/spinlock_api.h>
#include <linux/syscalls_api.h>
#include <linux/syscalls.h>
#include <linux/topology.h>
#include <linux/types.h>
+#include <linux/u64_stats_sync_api.h>
#include <linux/uaccess.h>
#include <linux/wait_api.h>
#include <linux/workqueue_api.h>
--
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 ` Ingo Molnar [this message]
2022-08-23 7:47 ` [PATCH 09/15] sched/headers: Introduce kernel/sched/build_policy.c " suhui_kernel
2022-08-24 15:50 ` Thomas Gleixner
2022-03-15 8:42 ` [PATCH 10/15] sched/headers: Standardize kernel/sched/sched.h header dependencies Ingo Molnar
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-10-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.