mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
sched: Have sched_class_highest define by vmlinux.lds.h
Now that the sched_class descriptors are defined by the linker script, and this needs to be aware of the existance of stop_sched_class when SMP is enabled or not, as it is used as the "highest" priority when defined. Move the declaration of sched_class_highest to the same location in the linker script that inserts stop_sched_class, and this will also make it easier to see what should be defined as the highest class, as this linker script location defines the priorities as well. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20191219214558.682913590@goodmis.org
This commit is contained in:
parent
590d697963
commit
c3a340f7e7
@ -114,11 +114,14 @@
|
|||||||
* relation to each other.
|
* relation to each other.
|
||||||
*/
|
*/
|
||||||
#define SCHED_DATA \
|
#define SCHED_DATA \
|
||||||
|
STRUCT_ALIGN(); \
|
||||||
|
__begin_sched_classes = .; \
|
||||||
*(__idle_sched_class) \
|
*(__idle_sched_class) \
|
||||||
*(__fair_sched_class) \
|
*(__fair_sched_class) \
|
||||||
*(__rt_sched_class) \
|
*(__rt_sched_class) \
|
||||||
*(__dl_sched_class) \
|
*(__dl_sched_class) \
|
||||||
*(__stop_sched_class)
|
*(__stop_sched_class) \
|
||||||
|
__end_sched_classes = .;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Align to a 32 byte boundary equal to the
|
* Align to a 32 byte boundary equal to the
|
||||||
|
@ -6646,6 +6646,14 @@ void __init sched_init(void)
|
|||||||
unsigned long ptr = 0;
|
unsigned long ptr = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Make sure the linker didn't screw up */
|
||||||
|
BUG_ON(&idle_sched_class + 1 != &fair_sched_class ||
|
||||||
|
&fair_sched_class + 1 != &rt_sched_class ||
|
||||||
|
&rt_sched_class + 1 != &dl_sched_class);
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
BUG_ON(&dl_sched_class + 1 != &stop_sched_class);
|
||||||
|
#endif
|
||||||
|
|
||||||
wait_bit_init();
|
wait_bit_init();
|
||||||
|
|
||||||
#ifdef CONFIG_FAIR_GROUP_SCHED
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
||||||
|
@ -1811,7 +1811,7 @@ struct sched_class {
|
|||||||
#ifdef CONFIG_FAIR_GROUP_SCHED
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
||||||
void (*task_change_group)(struct task_struct *p, int type);
|
void (*task_change_group)(struct task_struct *p, int type);
|
||||||
#endif
|
#endif
|
||||||
};
|
} __aligned(32); /* STRUCT_ALIGN(), vmlinux.lds.h */
|
||||||
|
|
||||||
static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
|
static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
|
||||||
{
|
{
|
||||||
@ -1825,17 +1825,18 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
|
|||||||
next->sched_class->set_next_task(rq, next, false);
|
next->sched_class->set_next_task(rq, next, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
/* Defined in include/asm-generic/vmlinux.lds.h */
|
||||||
#define sched_class_highest (&stop_sched_class)
|
extern struct sched_class __begin_sched_classes[];
|
||||||
#else
|
extern struct sched_class __end_sched_classes[];
|
||||||
#define sched_class_highest (&dl_sched_class)
|
|
||||||
#endif
|
#define sched_class_highest (__end_sched_classes - 1)
|
||||||
|
#define sched_class_lowest (__begin_sched_classes - 1)
|
||||||
|
|
||||||
#define for_class_range(class, _from, _to) \
|
#define for_class_range(class, _from, _to) \
|
||||||
for (class = (_from); class != (_to); class = class->next)
|
for (class = (_from); class != (_to); class--)
|
||||||
|
|
||||||
#define for_each_class(class) \
|
#define for_each_class(class) \
|
||||||
for_class_range(class, sched_class_highest, NULL)
|
for_class_range(class, sched_class_highest, sched_class_lowest)
|
||||||
|
|
||||||
extern const struct sched_class stop_sched_class;
|
extern const struct sched_class stop_sched_class;
|
||||||
extern const struct sched_class dl_sched_class;
|
extern const struct sched_class dl_sched_class;
|
||||||
|
Loading…
Reference in New Issue
Block a user