lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH 2/4] sched: Have sched_class_highest define by vmlinux.lds.h
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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>
---
include/asm-generic/vmlinux.lds.h | 11 ++++++++++-
kernel/sched/sched.h | 9 +++------
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 772d961c69a5..1c14c4ddf785 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -109,9 +109,16 @@
#endif

#ifdef CONFIG_SMP
-#define STOP_SCHED_CLASS *(__stop_sched_class)
+#define STOP_SCHED_CLASS \
+ STRUCT_ALIGN(); \
+ sched_class_highest = .; \
+ *(__stop_sched_class)
+#define BEFORE_DL_SCHED_CLASS
#else
#define STOP_SCHED_CLASS
+#define BEFORE_DL_SCHED_CLASS \
+ STRUCT_ALIGN(); \
+ sched_class_highest = .;
#endif

/*
@@ -120,9 +127,11 @@
* relation to each other.
*/
#define SCHED_DATA \
+ STRUCT_ALIGN(); \
*(__idle_sched_class) \
*(__fair_sched_class) \
*(__rt_sched_class) \
+ BEFORE_DL_SCHED_CLASS \
*(__dl_sched_class) \
STOP_SCHED_CLASS

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 280a3c735935..0554c588ad85 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1771,17 +1771,14 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
next->sched_class->set_next_task(rq, next, false);
}

-#ifdef CONFIG_SMP
-#define sched_class_highest (&stop_sched_class)
-#else
-#define sched_class_highest (&dl_sched_class)
-#endif
+/* Defined in include/asm-generic/vmlinux.lds.h */
+extern struct sched_class sched_class_highest;

#define for_class_range(class, _from, _to) \
for (class = (_from); class != (_to); class = class->next)

#define for_each_class(class) \
- for_class_range(class, sched_class_highest, NULL)
+ for_class_range(class, &sched_class_highest, NULL)

extern const struct sched_class stop_sched_class;
extern const struct sched_class dl_sched_class;
--
2.24.0

\
 
 \ /
  Last update: 2019-12-19 22:46    [W:0.109 / U:1.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site