aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_litmus.c
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-22 23:13:03 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-10-19 09:40:37 -0400
commitc8f95e3e04ffc1d96b7b615f8be9b7ac941ead15 (patch)
tree4bc26f0ea2c0c997363df500b1362d1bdf5d144e /litmus/sched_litmus.c
parent8ad8bfcab56a140389df2ed323b56d849e6cf5fb (diff)
Litmus core: set state to TASK_RUNNING before calling wake_up()
Having tasks that are !is_running() in shared structures is very confusing during development and debugging, and can likely mask bugs and/or create races. It seems like a strange choice that Linux changes a task's state only _after_ activating it. For LITMUS^RT tasks, we change this order.
Diffstat (limited to 'litmus/sched_litmus.c')
-rw-r--r--litmus/sched_litmus.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c
index c65388969789..52afec278ec8 100644
--- a/litmus/sched_litmus.c
+++ b/litmus/sched_litmus.c
@@ -157,6 +157,16 @@ static void enqueue_task_litmus(struct rq *rq, struct task_struct *p,
157 if (wakeup) { 157 if (wakeup) {
158 sched_trace_task_resume(p); 158 sched_trace_task_resume(p);
159 tsk_rt(p)->present = 1; 159 tsk_rt(p)->present = 1;
160 /* LITMUS^RT plugins need to update the state
161 * _before_ making it available in global structures.
162 * Linux gets away with being lazy about the task state
163 * update. We can't do that, hence we update the task
164 * state already here.
165 *
166 * WARNING: this needs to be re-evaluated when porting
167 * to newer kernel versions.
168 */
169 p->state = TASK_RUNNING;
160 litmus->task_wake_up(p); 170 litmus->task_wake_up(p);
161 171
162 rq->litmus.nr_running++; 172 rq->litmus.nr_running++;