From: Ingo Molnar Date: Tue, 22 Feb 2022 12:46:03 +0000 (+0100) Subject: sched/headers: Introduce kernel/sched/build_policy.c and build multiple .c files... X-Git-Tag: v5.18-rc1~169^2~5^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f96eca432015ddc1b621632488ebc345bca06791;p=thirdparty%2Fkernel%2Flinux.git sched/headers: Introduce kernel/sched/build_policy.c and build multiple .c files there 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 Reviewed-by: Peter Zijlstra --- diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile index 4a4785cb3cd29..976092b7bd452 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 0000000000000..6bb384ddcfab5 --- /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 0e196f0de4928..02d970a879edd 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -6,7 +6,6 @@ * * Author: Juri Lelli */ -#include "sched.h" static inline int parent(int i) { diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index b7ec42732b284..78a233d43757f 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 d2c072b0ef01f..fca2d7de4d3d5 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -15,8 +15,6 @@ * Michael Trimarchi , * Fabio Checconi */ -#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 d17b0a5ce6ac3..8f8b5020e76af 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 /* 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 a554e3bbab2b0..0f310768260c1 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -24,10 +24,6 @@ * Author: Vincent Guittot */ -#include -#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 7b4f4fbbb4048..ff4c044aed120 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 79c7a8a2be65c..f7d10b98e9110 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -113,8 +114,11 @@ #include #include #include +#include +#include #include #include +#include #include #include #include @@ -126,12 +130,16 @@ #include #include #include +#include #include #include +#include +#include #include #include #include #include +#include #include #include #include