Skip to content

Commit b9e9c6c

Browse files
author
Ingo Molnar
committed
sched/headers: Standardize kernel/sched/sched.h header dependencies
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 <[email protected]> Reviewed-by: Peter Zijlstra <[email protected]>
1 parent f96eca4 commit b9e9c6c

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

kernel/sched/build_policy.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*/
1414

1515
#include "sched.h"
16+
17+
#include "autogroup.h"
18+
#include "stats.h"
1619
#include "pelt.h"
1720

1821
#include "idle.c"

kernel/sched/build_utility.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include "sched.h"
1414
#include "sched-pelt.h"
15+
#include "stats.h"
16+
#include "autogroup.h"
1517

1618
#include <linux/sched_clock.h>
1719

kernel/sched/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#undef CREATE_TRACE_POINTS
1212

1313
#include "sched.h"
14+
#include "stats.h"
15+
#include "autogroup.h"
1416

1517
#include <linux/nospec.h>
1618
#include <linux/blkdev.h>

kernel/sched/fair.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
2222
*/
2323
#include "sched.h"
24+
#include "stats.h"
25+
#include "autogroup.h"
2426

2527
/*
2628
* Targeted preemption latency for CPU-bound tasks:

kernel/sched/sched.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,20 @@
9696
# include <asm/paravirt.h>
9797
#endif
9898

99+
#include <trace/events/sched.h>
100+
101+
#ifdef CONFIG_CGROUP_SCHED
102+
#include <linux/cgroup.h>
103+
#include <linux/psi.h>
104+
#endif
105+
106+
#ifdef CONFIG_SCHED_DEBUG
107+
# include <linux/static_key.h>
108+
#endif
109+
99110
#include "cpupri.h"
100111
#include "cpudeadline.h"
101112

102-
#include <trace/events/sched.h>
103-
104113
#ifdef CONFIG_SCHED_DEBUG
105114
# define SCHED_WARN_ON(x) WARN_ONCE(x, #x)
106115
#else
@@ -417,9 +426,6 @@ extern bool dl_cpu_busy(unsigned int cpu);
417426

418427
#ifdef CONFIG_CGROUP_SCHED
419428

420-
#include <linux/cgroup.h>
421-
#include <linux/psi.h>
422-
423429
struct cfs_rq;
424430
struct rt_rq;
425431

@@ -1919,9 +1925,6 @@ extern void flush_smp_call_function_from_idle(void);
19191925
static inline void flush_smp_call_function_from_idle(void) { }
19201926
#endif
19211927

1922-
#include "stats.h"
1923-
#include "autogroup.h"
1924-
19251928
#if defined(CONFIG_SCHED_CORE) && defined(CONFIG_SCHEDSTATS)
19261929

19271930
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)
20162019
* Tunables that become constants when CONFIG_SCHED_DEBUG is off:
20172020
*/
20182021
#ifdef CONFIG_SCHED_DEBUG
2019-
# include <linux/static_key.h>
20202022
# define const_debug __read_mostly
20212023
#else
20222024
# define const_debug const

kernel/sched/stats.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#ifndef _KERNEL_STATS_H
33
#define _KERNEL_STATS_H
44

5-
#ifdef CONFIG_SCHEDSTATS
6-
75
#include "sched.h"
86

7+
#ifdef CONFIG_SCHEDSTATS
8+
99
extern struct static_key_false sched_schedstats;
1010

1111
/*

0 commit comments

Comments
 (0)