2022-02-22 05:23:24 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
|
|
* These are various utility functions of the scheduler,
|
|
|
|
* built in a single compilation unit for build efficiency reasons.
|
|
|
|
*
|
|
|
|
* ( Incidentally, the size of the compilation unit is roughly
|
|
|
|
* comparable to core.c, fair.c, smp.c and policy.c, the other
|
|
|
|
* big compilation units. This helps balance build time, while
|
|
|
|
* coalescing source files to amortize header inclusion
|
|
|
|
* cost. )
|
|
|
|
*/
|
2021-07-19 03:43:51 -07:00
|
|
|
#include <linux/sched/clock.h>
|
|
|
|
#include <linux/sched/cputime.h>
|
|
|
|
#include <linux/sched/debug.h>
|
|
|
|
#include <linux/sched/isolation.h>
|
|
|
|
#include <linux/sched/loadavg.h>
|
2022-04-13 06:31:02 -07:00
|
|
|
#include <linux/sched/nohz.h>
|
2021-07-19 03:43:51 -07:00
|
|
|
#include <linux/sched/mm.h>
|
|
|
|
#include <linux/sched/rseq_api.h>
|
|
|
|
#include <linux/sched/task_stack.h>
|
|
|
|
|
|
|
|
#include <linux/cpufreq.h>
|
|
|
|
#include <linux/cpumask_api.h>
|
|
|
|
#include <linux/cpuset.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/energy_model.h>
|
|
|
|
#include <linux/hashtable_api.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/kobject_api.h>
|
|
|
|
#include <linux/membarrier.h>
|
|
|
|
#include <linux/mempolicy.h>
|
|
|
|
#include <linux/nmi.h>
|
|
|
|
#include <linux/nospec.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/psi.h>
|
|
|
|
#include <linux/ptrace_api.h>
|
|
|
|
#include <linux/sched_clock.h>
|
|
|
|
#include <linux/security.h>
|
|
|
|
#include <linux/spinlock_api.h>
|
|
|
|
#include <linux/swait_api.h>
|
|
|
|
#include <linux/timex.h>
|
|
|
|
#include <linux/utsname.h>
|
|
|
|
#include <linux/wait_api.h>
|
|
|
|
#include <linux/workqueue_api.h>
|
|
|
|
|
|
|
|
#include <uapi/linux/prctl.h>
|
|
|
|
#include <uapi/linux/sched/types.h>
|
2022-02-22 05:23:24 -07:00
|
|
|
|
sched/headers: Reorganize, clean up and optimize kernel/sched/sched.h dependencies
Remove all headers, except the ones required to make this header
build standalone.
Also include stats.h in sched.h explicitly - dependencies already
require this.
Summary of the build speedup gained through the last ~15 scheduler build &
header dependency patches:
Cumulative scheduler (kernel/sched/) build time speedup on a
Linux distribution's config, which enables all scheduler features,
compared to the vanilla kernel:
_____________________________________________________________________________
|
| Vanilla kernel (v5.13-rc7):
|_____________________________________________________________________________
|
| Performance counter stats for 'make -j96 kernel/sched/' (3 runs):
|
| 126,975,564,374 instructions # 1.45 insn per cycle ( +- 0.00% )
| 87,637,847,671 cycles # 3.959 GHz ( +- 0.30% )
| 22,136.96 msec cpu-clock # 7.499 CPUs utilized ( +- 0.29% )
|
| 2.9520 +- 0.0169 seconds time elapsed ( +- 0.57% )
|_____________________________________________________________________________
|
| Patched kernel:
|_____________________________________________________________________________
|
| Performance counter stats for 'make -j96 kernel/sched/' (3 runs):
|
| 50,420,496,914 instructions # 1.47 insn per cycle ( +- 0.00% )
| 34,234,322,038 cycles # 3.946 GHz ( +- 0.31% )
| 8,675.81 msec cpu-clock # 3.053 CPUs utilized ( +- 0.45% )
|
| 2.8420 +- 0.0181 seconds time elapsed ( +- 0.64% )
|_____________________________________________________________________________
Summary:
- CPU time used to build the scheduler dropped by -60.9%, a reduction
from 22.1 clock-seconds to 8.7 clock-seconds.
- Wall-clock time to build the scheduler dropped by -3.9%, a reduction
from 2.95 seconds to 2.84 seconds.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Peter Zijlstra <peterz@infradead.org>
2022-02-22 06:51:58 -07:00
|
|
|
#include <asm/switch_to.h>
|
|
|
|
|
2022-02-22 05:23:24 -07:00
|
|
|
#include "sched.h"
|
|
|
|
#include "sched-pelt.h"
|
2022-02-13 00:19:43 -07:00
|
|
|
#include "stats.h"
|
|
|
|
#include "autogroup.h"
|
2022-02-22 05:23:24 -07:00
|
|
|
|
|
|
|
#include "clock.c"
|
|
|
|
|
|
|
|
#ifdef CONFIG_CGROUP_CPUACCT
|
|
|
|
# include "cpuacct.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
|
|
# include "cpufreq.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL
|
|
|
|
# include "cpufreq_schedutil.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
|
|
# include "debug.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHEDSTATS
|
|
|
|
# include "stats.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "loadavg.c"
|
|
|
|
#include "completion.c"
|
|
|
|
#include "swait.c"
|
|
|
|
#include "wait_bit.c"
|
|
|
|
#include "wait.c"
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
# include "cpupri.c"
|
|
|
|
# include "stop_task.c"
|
|
|
|
# include "topology.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_CORE
|
|
|
|
# include "core_sched.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_PSI
|
|
|
|
# include "psi.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_MEMBARRIER
|
|
|
|
# include "membarrier.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_ISOLATION
|
|
|
|
# include "isolation.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_AUTOGROUP
|
|
|
|
# include "autogroup.c"
|
|
|
|
#endif
|