aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-10-23 16:26:35 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-10-23 16:28:23 -0400
commitc285117cf88204007e4fce672b964c6ab015e6bc (patch)
tree6433a99109692a3898856dcf25527681e3e490d0
parent39dcc900b0bdde79c9bb27cf8ea99e9dd55618cc (diff)
Color Queue: track the units of work done by each task.
-rw-r--r--include/litmus/color.h4
-rw-r--r--include/litmus/color_queue.h4
-rw-r--r--litmus/color.c8
-rw-r--r--litmus/color_queue.c22
4 files changed, 20 insertions, 18 deletions
diff --git a/include/litmus/color.h b/include/litmus/color.h
index 50f1f7399e70..2f7e19cd4602 100644
--- a/include/litmus/color.h
+++ b/include/litmus/color.h
@@ -83,8 +83,8 @@ int color_nr_pages_handler(struct ctl_table *, int, void __user *,
83int color_reclaim_pages_handler(struct ctl_table *, int, void __user *, 83int color_reclaim_pages_handler(struct ctl_table *, int, void __user *,
84 size_t *, loff_t *); 84 size_t *, loff_t *);
85 85
86void color_sched_in_task(struct task_struct*); 86int color_sched_in_task(struct task_struct*);
87void color_sched_out_task(struct task_struct*); 87int color_sched_out_task(struct task_struct*);
88 88
89#ifdef CONFIG_LOCKDEP 89#ifdef CONFIG_LOCKDEP
90#define LITMUS_LOCKDEP_NAME_MAX_LEN 50 90#define LITMUS_LOCKDEP_NAME_MAX_LEN 50
diff --git a/include/litmus/color_queue.h b/include/litmus/color_queue.h
index 62d862c3e2b0..95dd395c0b9c 100644
--- a/include/litmus/color_queue.h
+++ b/include/litmus/color_queue.h
@@ -55,8 +55,8 @@ struct color_queue_request {
55int setup_flusher_array(void); 55int setup_flusher_array(void);
56 56
57/* See comments in C file! */ 57/* See comments in C file! */
58void color_queue_enqueue_read(struct task_struct *ts); 58int color_queue_enqueue_read(struct task_struct *ts);
59void color_queue_enqueue_flush(struct task_struct *ts); 59int color_queue_enqueue_flush(struct task_struct *ts);
60 60
61void cleanup_color_page_infos(struct list_head *head); 61void cleanup_color_page_infos(struct list_head *head);
62 62
diff --git a/litmus/color.c b/litmus/color.c
index 2ba67f1dc06f..26f800e785ae 100644
--- a/litmus/color.c
+++ b/litmus/color.c
@@ -219,19 +219,19 @@ void reclaim_pages(struct vm_area_struct *vma)
219/* 219/*
220 * Does way assignment and page read in. 220 * Does way assignment and page read in.
221 */ 221 */
222void color_sched_in_task(struct task_struct *t) 222int color_sched_in_task(struct task_struct *t)
223{ 223{
224 color_page_info_take_ways(t); 224 color_page_info_take_ways(t);
225 color_queue_enqueue_read(t); 225 return color_queue_enqueue_read(t);
226} 226}
227 227
228/* 228/*
229 * Does way give-back and page flush. 229 * Does way give-back and page flush.
230 */ 230 */
231void color_sched_out_task(struct task_struct *t) 231int color_sched_out_task(struct task_struct *t)
232{ 232{
233 color_page_info_release_ways(t); 233 color_page_info_release_ways(t);
234 color_queue_enqueue_flush(t); 234 return color_queue_enqueue_flush(t);
235} 235}
236 236
237asmlinkage long sys_set_color_page_info(struct color_ctrl_page __user *user_color_ctrl) 237asmlinkage long sys_set_color_page_info(struct color_ctrl_page __user *user_color_ctrl)
diff --git a/litmus/color_queue.c b/litmus/color_queue.c
index 78177572da51..b4a081c91be6 100644
--- a/litmus/color_queue.c
+++ b/litmus/color_queue.c
@@ -115,7 +115,7 @@ static void color_page_info_add_work(struct color_page_info *info, void *vaddr_s
115 } 115 }
116} 116}
117 117
118static void color_queue_submit_work(void); 118static int color_queue_submit_work(void);
119 119
120/* 120/*
121 * Assumes this is called on the CPU that @ts ran on and that this CPU that is 121 * Assumes this is called on the CPU that @ts ran on and that this CPU that is
@@ -123,7 +123,7 @@ static void color_queue_submit_work(void);
123 * 123 *
124 * Also assumes that @way set for each color_page_info before calling! 124 * Also assumes that @way set for each color_page_info before calling!
125 */ 125 */
126void color_queue_enqueue_read(struct task_struct *ts) 126int color_queue_enqueue_read(struct task_struct *ts)
127{ 127{
128 struct color_page_info *cur_info; 128 struct color_page_info *cur_info;
129 129
@@ -141,7 +141,7 @@ void color_queue_enqueue_read(struct task_struct *ts)
141 color_page_info_add_work(cur_info, vaddr_start); 141 color_page_info_add_work(cur_info, vaddr_start);
142 } 142 }
143 143
144 color_queue_submit_work(); 144 return color_queue_submit_work();
145} 145}
146 146
147/* 147/*
@@ -151,7 +151,7 @@ void color_queue_enqueue_read(struct task_struct *ts)
151 * Also assumes that @way is still set to the way this page was read into to 151 * Also assumes that @way is still set to the way this page was read into to
152 * find the proper address to flush. 152 * find the proper address to flush.
153 */ 153 */
154void color_queue_enqueue_flush(struct task_struct *ts) 154int color_queue_enqueue_flush(struct task_struct *ts)
155{ 155{
156 struct color_page_info *cur_info; 156 struct color_page_info *cur_info;
157 157
@@ -165,7 +165,7 @@ void color_queue_enqueue_flush(struct task_struct *ts)
165 color_page_info_add_work(cur_info, vaddr_start); 165 color_page_info_add_work(cur_info, vaddr_start);
166 } 166 }
167 167
168 color_queue_submit_work(); 168 return color_queue_submit_work();
169} 169}
170 170
171static void do_work_read(struct color_queue_request *request) 171static void do_work_read(struct color_queue_request *request)
@@ -264,11 +264,11 @@ static void wait_next_phase(void)
264 } 264 }
265} 265}
266 266
267static void color_queue_loop(void) 267static int color_queue_loop(void)
268{ 268{
269 struct cpu_entry *entry = &__get_cpu_var(cpu_entries); 269 struct cpu_entry *entry = &__get_cpu_var(cpu_entries);
270 struct color_queue_request *request; 270 struct color_queue_request *request;
271 int nr_work; 271 int nr_work, nr_work_done_by_task = 0;
272 272
273 for (;;) { 273 for (;;) {
274 raw_spin_lock(&entry->lock); 274 raw_spin_lock(&entry->lock);
@@ -307,6 +307,7 @@ static void color_queue_loop(void)
307 QTRACE(color_queue, "found a piece of work to do: %p\n", request); 307 QTRACE(color_queue, "found a piece of work to do: %p\n", request);
308 raw_spin_unlock(&color_queue.lock); 308 raw_spin_unlock(&color_queue.lock);
309 do_work_son(request); 309 do_work_son(request);
310 ++nr_work_done_by_task;
310 } else { 311 } else {
311 /* we need to wait for the next phase */ 312 /* we need to wait for the next phase */
312 color_queue.at_barrier++; 313 color_queue.at_barrier++;
@@ -315,16 +316,17 @@ static void color_queue_loop(void)
315 wait_next_phase(); 316 wait_next_phase();
316 } 317 }
317 } 318 }
319
320 return nr_work_done_by_task;
318} 321}
319 322
320/* 323/*
321 * Actually enqueues the work on the color queue and enters the work loop. 324 * Actually enqueues the work on the color queue and enters the work loop.
322 */ 325 */
323static void color_queue_submit_work(void) 326static int color_queue_submit_work(void)
324{ 327{
325 struct cpu_entry *entry = &__get_cpu_var(cpu_entries); 328 struct cpu_entry *entry = &__get_cpu_var(cpu_entries);
326 329
327
328 raw_spin_lock(&color_queue.lock); 330 raw_spin_lock(&color_queue.lock);
329 QTRACE(color_queue, "start submit work\n"); 331 QTRACE(color_queue, "start submit work\n");
330 entry->phase = color_queue.phase; 332 entry->phase = color_queue.phase;
@@ -332,7 +334,7 @@ static void color_queue_submit_work(void)
332 list_splice_tail_init(&entry->enqueue, &color_queue.queue); 334 list_splice_tail_init(&entry->enqueue, &color_queue.queue);
333 QTRACE(color_queue, "end submit work\n"); 335 QTRACE(color_queue, "end submit work\n");
334 raw_spin_unlock(&color_queue.lock); 336 raw_spin_unlock(&color_queue.lock);
335 color_queue_loop(); 337 return color_queue_loop();
336} 338}
337 339
338void cleanup_color_page_infos(struct list_head *head) 340void cleanup_color_page_infos(struct list_head *head)