aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-10-09 22:07:46 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-10-09 22:07:46 -0400
commitba42974ea389f7f69800ddb39c7072f5252cbf98 (patch)
treed6019bb43aeae579118260c354a5dcfed3d7df4c
parentbc92369ba24f72b916384ed80d4381549c6537a7 (diff)
Allow events to be cancelled when their list is processed
-rw-r--r--litmus/event_group.c8
-rw-r--r--litmus/rt_domain.c2
-rw-r--r--litmus/sched_mc.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/litmus/event_group.c b/litmus/event_group.c
index 518ccb459137..365ec1ee3651 100644
--- a/litmus/event_group.c
+++ b/litmus/event_group.c
@@ -33,7 +33,7 @@ static enum hrtimer_restart on_timer(struct hrtimer *timer)
33 unsigned long num = 0; 33 unsigned long num = 0;
34 struct event_list *el; 34 struct event_list *el;
35 struct rt_event *e; 35 struct rt_event *e;
36 struct list_head *pos, *safe, events; 36 struct list_head *pos, safe, events;
37 37
38 el = container_of(timer, struct event_list, timer); 38 el = container_of(timer, struct event_list, timer);
39 39
@@ -47,16 +47,18 @@ static enum hrtimer_restart on_timer(struct hrtimer *timer)
47 list_replace_init(&el->events, &events); 47 list_replace_init(&el->events, &events);
48 48
49 /* Fire events */ 49 /* Fire events */
50 list_for_each_safe(pos, safe, &events) { 50 for (pos = events.next; prefetch(pos->next), pos != &events;) {
51 num++; 51 num++;
52 e = list_entry(pos, struct rt_event, events_node); 52 e = list_entry(pos, struct rt_event, events_node);
53 VTRACE("Dequeueing event 0x%p with prio %d from 0x%p\n", 53 VTRACE("Dequeueing event 0x%p with prio %d from 0x%p\n",
54 e, e->prio, el); 54 e, e->prio, el);
55 list_replace(pos, &safe);
55 list_del_init(pos); 56 list_del_init(pos);
56 e->function(e); 57 e->function(e);
58 pos = safe.next;
57 } 59 }
58 VTRACE("Exhausted %d events from list 0x%p\n", num, el); 60 VTRACE("Exhausted %d events from list 0x%p\n", num, el);
59 sched_trace_action(NULL, num); 61 /* sched_trace_action(NULL, num); */
60 return HRTIMER_NORESTART; 62 return HRTIMER_NORESTART;
61} 63}
62 64
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c
index f242f33e990e..3355eb5a73be 100644
--- a/litmus/rt_domain.c
+++ b/litmus/rt_domain.c
@@ -406,7 +406,7 @@ static void pd_requeue(domain_t *dom, struct task_struct *task)
406 rt_domain_t *domain = (rt_domain_t*)dom->data; 406 rt_domain_t *domain = (rt_domain_t*)dom->data;
407 407
408 BUG_ON(!task || !is_realtime(task)); 408 BUG_ON(!task || !is_realtime(task));
409 TRACE_TASK(task, "Requeueing"); 409 TRACE_TASK(task, "Requeueing\n");
410 BUG_ON(is_queued(task)); 410 BUG_ON(is_queued(task));
411 BUG_ON(get_task_domain(task) != dom); 411 BUG_ON(get_task_domain(task) != dom);
412 412
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index 61eb961eda23..1d1ecbb8c9c4 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -407,10 +407,10 @@ static void preempt(struct domain *dom, struct crit_entry *ce)
407 TRACE_CRIT_ENTRY(ce, "Preempted by " TS "\n", TA(task)); 407 TRACE_CRIT_ENTRY(ce, "Preempted by " TS "\n", TA(task));
408 408
409 /* Per-domain preemption */ 409 /* Per-domain preemption */
410 link_task_to_crit(ce, task);
410 if (old && can_requeue(old)) { 411 if (old && can_requeue(old)) {
411 dom->requeue(dom, old); 412 dom->requeue(dom, old);
412 } 413 }
413 link_task_to_crit(ce, task);
414 update_crit_position(ce); 414 update_crit_position(ce);
415 415
416 /* Preempt actual execution if this is a running task */ 416 /* Preempt actual execution if this is a running task */
@@ -987,7 +987,8 @@ void mc_finish_switch(struct task_struct *prev)
987{ 987{
988 struct cpu_entry* entry = &__get_cpu_var(cpus); 988 struct cpu_entry* entry = &__get_cpu_var(cpus);
989 entry->scheduled = is_realtime(current) ? current : NULL; 989 entry->scheduled = is_realtime(current) ? current : NULL;
990 TRACE_TASK(prev, "Switched away from\n"); 990 TRACE_TASK(prev, "Switched away from to (something/%d)\n",
991 ((entry->scheduled) ? entry->scheduled->pid : 0));
991} 992}
992 993
993/* 994/*