diff options
author | Nathan O <otternes@cs.unc.edu> | 2020-02-13 12:38:24 -0500 |
---|---|---|
committer | Nathan O <otternes@cs.unc.edu> | 2020-02-13 12:43:29 -0500 |
commit | 96d38276b2dc7f5a5a0bdfd4407f88b6833ab031 (patch) | |
tree | 1449270672ed7fe03eb29b9aee648361e1314931 /kernel/sched | |
parent | 665d44284956094a722b4692ed07df1f692d0232 (diff) |
Fix balancing issue, GEDF plugin
- Fixed a bug where some new balancing code wasn't commented out when
it needed to be. (It wasn't in the version of Linux that the previous
version of LITMUS was based on, so I missed it earlier.)
- The GSN-EDF plugin can now be activated, and runs tasks without
crashing (though I haven't verified that it schedules stuff in the
correct order yet).
- *All remaining plugins probably need to be modified in the same was
as the GSN-EDF plugin*. Specifically, the "prev" argument to the
"<plugin>_schedule(...)" function may be NULL, and the plugin must be
able to handle such a case!
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 28 | ||||
-rw-r--r-- | kernel/sched/litmus.c | 19 |
2 files changed, 25 insertions, 22 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 34525bf04f0f..9ab7655edd2d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3993,20 +3993,20 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) | |||
3993 | restart: | 3993 | restart: |
3994 | */ | 3994 | */ |
3995 | 3995 | ||
3996 | #ifdef CONFIG_SMP | 3996 | //#ifdef CONFIG_SMP |
3997 | /* | 3997 | // /* |
3998 | * We must do the balancing pass before put_next_task(), such | 3998 | // * We must do the balancing pass before put_next_task(), such |
3999 | * that when we release the rq->lock the task is in the same | 3999 | // * that when we release the rq->lock the task is in the same |
4000 | * state as before we took rq->lock. | 4000 | // * state as before we took rq->lock. |
4001 | * | 4001 | // * |
4002 | * We can terminate the balance pass as soon as we know there is | 4002 | // * We can terminate the balance pass as soon as we know there is |
4003 | * a runnable task of @class priority or higher. | 4003 | // * a runnable task of @class priority or higher. |
4004 | */ | 4004 | // */ |
4005 | for_class_range(class, prev->sched_class, &idle_sched_class) { | 4005 | // for_class_range(class, prev->sched_class, &idle_sched_class) { |
4006 | if (class->balance(rq, prev, rf)) | 4006 | // if (class->balance(rq, prev, rf)) |
4007 | break; | 4007 | // break; |
4008 | } | 4008 | // } |
4009 | #endif | 4009 | //#endif |
4010 | 4010 | ||
4011 | put_prev_task(rq, prev); | 4011 | put_prev_task(rq, prev); |
4012 | 4012 | ||
diff --git a/kernel/sched/litmus.c b/kernel/sched/litmus.c index 468aa0197d1d..38f638f7eb4f 100644 --- a/kernel/sched/litmus.c +++ b/kernel/sched/litmus.c | |||
@@ -50,9 +50,14 @@ litmus_schedule(struct rq *rq, struct task_struct *prev) | |||
50 | 50 | ||
51 | sched_state_plugin_check(); | 51 | sched_state_plugin_check(); |
52 | 52 | ||
53 | if (!next) { | ||
54 | update_enforcement_timer(next); | ||
55 | return next; | ||
56 | } | ||
57 | |||
53 | #ifdef CONFIG_SMP | 58 | #ifdef CONFIG_SMP |
54 | /* check if a global plugin pulled a task from a different RQ */ | 59 | /* check if a global plugin pulled a task from a different RQ */ |
55 | if (next && task_rq(next) != rq) { | 60 | if (task_rq(next) != rq) { |
56 | /* we need to migrate the task */ | 61 | /* we need to migrate the task */ |
57 | other_rq = task_rq(next); | 62 | other_rq = task_rq(next); |
58 | from_where = other_rq->cpu; | 63 | from_where = other_rq->cpu; |
@@ -168,7 +173,7 @@ litmus_schedule(struct rq *rq, struct task_struct *prev) | |||
168 | #endif | 173 | #endif |
169 | 174 | ||
170 | /* check if the task became invalid while we dropped the lock */ | 175 | /* check if the task became invalid while we dropped the lock */ |
171 | if (next && (!is_realtime(next) || !tsk_rt(next)->present)) { | 176 | if (!is_realtime(next) || !tsk_rt(next)->present) { |
172 | TRACE_TASK(next, | 177 | TRACE_TASK(next, |
173 | "BAD: next (no longer?) valid\n"); | 178 | "BAD: next (no longer?) valid\n"); |
174 | litmus->next_became_invalid(next); | 179 | litmus->next_became_invalid(next); |
@@ -176,15 +181,13 @@ litmus_schedule(struct rq *rq, struct task_struct *prev) | |||
176 | next = NULL; | 181 | next = NULL; |
177 | } | 182 | } |
178 | 183 | ||
179 | if (next) { | ||
180 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
181 | next->rt_param.stack_in_use = rq->cpu; | 185 | next->rt_param.stack_in_use = rq->cpu; |
182 | #else | 186 | #else |
183 | next->rt_param.stack_in_use = 0; | 187 | next->rt_param.stack_in_use = 0; |
184 | #endif | 188 | #endif |
185 | update_rq_clock(rq); | 189 | update_rq_clock(rq); |
186 | next->se.exec_start = rq->clock; | 190 | next->se.exec_start = rq->clock; |
187 | } | ||
188 | 191 | ||
189 | out: | 192 | out: |
190 | update_enforcement_timer(next); | 193 | update_enforcement_timer(next); |