diff options
Diffstat (limited to 'litmus/ce_domain.c')
-rw-r--r-- | litmus/ce_domain.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/litmus/ce_domain.c b/litmus/ce_domain.c index 5b4fd1cb438f..d6f713fbf789 100644 --- a/litmus/ce_domain.c +++ b/litmus/ce_domain.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <litmus/rt_param.h> | 7 | #include <litmus/rt_param.h> |
8 | #include <litmus/domain.h> | 8 | #include <litmus/domain.h> |
9 | #include <litmus/sched_mc.h> | 9 | #include <litmus/sched_mc.h> |
10 | #include <litmus/ce_domain.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * Called for: | 13 | * Called for: |
@@ -41,24 +42,13 @@ void ce_requeue(domain_t *dom, struct task_struct *ts) | |||
41 | } | 42 | } |
42 | } | 43 | } |
43 | 44 | ||
45 | void mc_ce_task_exit(struct task_struct*); | ||
44 | /* | 46 | /* |
45 | * Called when a task exits the system. | 47 | * Called when a task exits the system. |
46 | */ | 48 | */ |
47 | void ce_exit(domain_t *dom, struct task_struct *ts) | 49 | void ce_task_exit(domain_t *dom, struct task_struct *ts) |
48 | { | 50 | { |
49 | struct ce_dom_data *ce_data = dom->data; | 51 | mc_ce_task_exit(ts); |
50 | const int lvl_a_id = tsk_mc_data(ts)->mc_task.lvl_a_id; | ||
51 | struct pid *pid; | ||
52 | |||
53 | BUG_ON(task_cpu(ts) != get_partition(ts)); | ||
54 | BUG_ON(CRIT_LEVEL_A != tsk_mc_crit(ts)); | ||
55 | BUG_ON(lvl_a_id >= ce_data->num_pid_entries); | ||
56 | pid = ce_data->pid_entries[lvl_a_id].pid; | ||
57 | BUG_ON(!pid); | ||
58 | put_pid(pid); | ||
59 | ce_data->pid_entries[lvl_a_id].pid = NULL; | ||
60 | if (ce_data->should_schedule == ts) | ||
61 | ce_data->should_schedule = NULL; | ||
62 | } | 52 | } |
63 | 53 | ||
64 | /* | 54 | /* |
@@ -80,11 +70,12 @@ struct task_struct* ce_peek_and_take_ready(domain_t *dom) | |||
80 | return ret; | 70 | return ret; |
81 | } | 71 | } |
82 | 72 | ||
83 | int ce_higher_prio(domain_t *dom, struct task_struct *_a, | 73 | int ce_higher_prio(struct task_struct *_a, |
84 | struct task_struct *_b) | 74 | struct task_struct *_b) |
85 | { | 75 | { |
86 | const struct task_struct *a = _a; | 76 | const struct task_struct *a = _a; |
87 | struct ce_dom_data *ce_data = dom->data; | 77 | const domain_t *dom = get_task_domain(a); |
78 | const struct ce_dom_data *ce_data = dom->data; | ||
88 | return (a == ce_data->should_schedule); | 79 | return (a == ce_data->should_schedule); |
89 | } | 80 | } |
90 | 81 | ||
@@ -102,18 +93,18 @@ void ce_start(struct task_struct *ts, lt_t start) | |||
102 | mc_ce_release_at(ts, start); | 93 | mc_ce_release_at(ts, start); |
103 | } | 94 | } |
104 | 95 | ||
96 | domain_data_t *ce_domain_for(int); | ||
105 | long mc_ce_activate_plugin(void); | 97 | long mc_ce_activate_plugin(void); |
106 | domain_t *ce_domain_for(int); | ||
107 | long ce_activate_plugin(void) | 98 | long ce_activate_plugin(void) |
108 | { | 99 | { |
109 | domain_t *dom; | 100 | domain_data_t *dom_data; |
110 | struct ce_dom_data *ce_data; | 101 | struct ce_dom_data *ce_data; |
111 | int cpu; | 102 | int cpu; |
112 | 103 | ||
113 | /* first change the timer callback function */ | 104 | /* first change the timer callback function */ |
114 | for_each_online_cpu(cpu) { | 105 | for_each_online_cpu(cpu) { |
115 | dom = ce_domain_for(cpu); | 106 | dom_data = ce_domain_for(cpu); |
116 | ce_data = dom->data; | 107 | ce_data = dom_data->domain.data; |
117 | ce_data->timer.function = ce_timer_function; | 108 | ce_data->timer.function = ce_timer_function; |
118 | } | 109 | } |
119 | /* then run the regular CE activate plugin */ | 110 | /* then run the regular CE activate plugin */ |