hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/kernel/sched/stop_task.c
....@@ -11,10 +11,15 @@
1111
1212 #ifdef CONFIG_SMP
1313 static int
14
-select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags,
15
- int sibling_count_hint)
14
+select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags)
1615 {
1716 return task_cpu(p); /* stop tasks as never migrate */
17
+}
18
+
19
+static int
20
+balance_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
21
+{
22
+ return sched_stop_runnable(rq);
1823 }
1924 #endif /* CONFIG_SMP */
2025
....@@ -24,19 +29,18 @@
2429 /* we're never preempted */
2530 }
2631
27
-static struct task_struct *
28
-pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
32
+static void set_next_task_stop(struct rq *rq, struct task_struct *stop, bool first)
2933 {
30
- struct task_struct *stop = rq->stop;
34
+ stop->se.exec_start = rq_clock_task(rq);
35
+}
3136
32
- if (!stop || !task_on_rq_queued(stop))
37
+static struct task_struct *pick_next_task_stop(struct rq *rq)
38
+{
39
+ if (!sched_stop_runnable(rq))
3340 return NULL;
3441
35
- put_prev_task(rq, prev);
36
-
37
- stop->se.exec_start = rq_clock_task(rq);
38
-
39
- return stop;
42
+ set_next_task_stop(rq, rq->stop, true);
43
+ return rq->stop;
4044 }
4145
4246 static void
....@@ -87,13 +91,6 @@
8791 {
8892 }
8993
90
-static void set_curr_task_stop(struct rq *rq)
91
-{
92
- struct task_struct *stop = rq->stop;
93
-
94
- stop->se.exec_start = rq_clock_task(rq);
95
-}
96
-
9794 static void switched_to_stop(struct rq *rq, struct task_struct *p)
9895 {
9996 BUG(); /* its impossible to change to this class */
....@@ -105,12 +102,6 @@
105102 BUG(); /* how!?, what priority? */
106103 }
107104
108
-static unsigned int
109
-get_rr_interval_stop(struct rq *rq, struct task_struct *task)
110
-{
111
- return 0;
112
-}
113
-
114105 static void update_curr_stop(struct rq *rq)
115106 {
116107 }
....@@ -118,8 +109,8 @@
118109 /*
119110 * Simple, special scheduling class for the per-CPU stop tasks:
120111 */
121
-const struct sched_class stop_sched_class = {
122
- .next = &dl_sched_class,
112
+const struct sched_class stop_sched_class
113
+ __section("__stop_sched_class") = {
123114
124115 .enqueue_task = enqueue_task_stop,
125116 .dequeue_task = dequeue_task_stop,
....@@ -129,16 +120,15 @@
129120
130121 .pick_next_task = pick_next_task_stop,
131122 .put_prev_task = put_prev_task_stop,
123
+ .set_next_task = set_next_task_stop,
132124
133125 #ifdef CONFIG_SMP
126
+ .balance = balance_stop,
134127 .select_task_rq = select_task_rq_stop,
135128 .set_cpus_allowed = set_cpus_allowed_common,
136129 #endif
137130
138
- .set_curr_task = set_curr_task_stop,
139131 .task_tick = task_tick_stop,
140
-
141
- .get_rr_interval = get_rr_interval_stop,
142132
143133 .prio_changed = prio_changed_stop,
144134 .switched_to = switched_to_stop,