aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2017-05-01 14:13:05 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2017-05-01 14:13:05 -0400
commitd97c84a58867f481fede002fbd1510fc51b34e9e (patch)
treee38052cab5dc4fb81207e979d56e53aeb55029c1
parentb388244876da9dbb2b7449bcc467fe4378ce1009 (diff)
RTSS 2017 submissionwip-modechange
-rw-r--r--include/litmus/trace.h1
-rw-r--r--litmus/bank_proc.c80
-rw-r--r--litmus/jobs.c3
-rw-r--r--litmus/litmus.c111
-rw-r--r--litmus/sched_mc2.c458
5 files changed, 96 insertions, 557 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h
index eb0a07f4ba04..4dbb39ea8a14 100644
--- a/include/litmus/trace.h
+++ b/include/litmus/trace.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_SCHED_OVERHEAD_TRACE 4#ifdef CONFIG_SCHED_OVERHEAD_TRACE
5 5
6
7#include <litmus/feather_trace.h> 6#include <litmus/feather_trace.h>
8#include <litmus/feather_buffer.h> 7#include <litmus/feather_buffer.h>
9 8
diff --git a/litmus/bank_proc.c b/litmus/bank_proc.c
index 08b58f94c391..097cff177a2d 100644
--- a/litmus/bank_proc.c
+++ b/litmus/bank_proc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * bank_proc.c -- Implementation of the page coloring for cache and bank partition. 2 * bank_proc.c -- Implementation of the page coloring for cache and bank partition.
3 * The file will keep a pool of colored pages. Users can require pages with 3 * The file will keep a pool of colored pages. Users can require pages with
4 * specific color or bank number. 4 * specific color or bank number.
5 * Part of the code is modified from Jonathan Herman's code 5 * Part of the code is modified from Jonathan Herman's code
6 */ 6 */
7#include <linux/init.h> 7#include <linux/init.h>
@@ -19,9 +19,6 @@
19#include <litmus/sched_trace.h> 19#include <litmus/sched_trace.h>
20#include <litmus/litmus.h> 20#include <litmus/litmus.h>
21 21
22//#define TRACE(fmt, args...) do {} while (false)
23//#define TRACE_TASK(fmt, args...) do {} while (false)
24
25#define LITMUS_LOCKDEP_NAME_MAX_LEN 50 22#define LITMUS_LOCKDEP_NAME_MAX_LEN 50
26 23
27// This Address Decoding is used in imx6-sabredsd platform 24// This Address Decoding is used in imx6-sabredsd platform
@@ -86,7 +83,6 @@ int node_index[9] = {
86 83
87struct mutex void_lockdown_proc; 84struct mutex void_lockdown_proc;
88 85
89
90/* 86/*
91 * Every page list should contain a lock, a list, and a number recording how many pages it store 87 * Every page list should contain a lock, a list, and a number recording how many pages it store
92 */ 88 */
@@ -105,7 +101,6 @@ static struct color_group *color_groups;
105 */ 101 */
106unsigned int counting_one_set(unsigned int v) 102unsigned int counting_one_set(unsigned int v)
107{ 103{
108// unsigned int v; // count the number of bits set in v
109 unsigned int c; // c accumulates the total bits set in v 104 unsigned int c; // c accumulates the total bits set in v
110 105
111 for (c = 0; v; v >>= 1) 106 for (c = 0; v; v >>= 1)
@@ -257,8 +252,6 @@ static inline unsigned int page_list_index(struct page *page)
257{ 252{
258 unsigned int idx; 253 unsigned int idx;
259 idx = (page_color(page) + page_bank(page)*(number_cachecolors)); 254 idx = (page_color(page) + page_bank(page)*(number_cachecolors));
260// printk("address = %lx, ", page_to_phys(page));
261// printk("color(%d), bank(%d), indx = %d\n", page_color(page), page_bank(page), idx);
262 255
263 return idx; 256 return idx;
264} 257}
@@ -289,10 +282,10 @@ static void show_nr_pages(void)
289 printk("show nr pages***************************************\n"); 282 printk("show nr pages***************************************\n");
290 for (i = 0; i < NUM_PAGE_LIST; ++i) { 283 for (i = 0; i < NUM_PAGE_LIST; ++i) {
291 cgroup = &color_groups[i]; 284 cgroup = &color_groups[i];
292 printk("(%03d) = %03d, ", i, atomic_read(&cgroup->nr_pages)); 285 printk("(%03ld) = %03d, ", i, atomic_read(&cgroup->nr_pages));
293 if((i % 8) ==7){ 286 if((i % 8) ==7) {
294 printk("\n"); 287 printk("\n");
295 } 288 }
296 } 289 }
297} 290}
298 291
@@ -316,6 +309,7 @@ void add_page_to_color_list(struct page *page)
316 * Replenish the page pool. 309 * Replenish the page pool.
317 * If the newly allocate page is what we want, it will be pushed to the correct page list 310 * If the newly allocate page is what we want, it will be pushed to the correct page list
318 * otherwise, it will be freed. 311 * otherwise, it will be freed.
312 * A user needs to invoke this function until the page pool has enough pages.
319 */ 313 */
320static int do_add_pages(void) 314static int do_add_pages(void)
321{ 315{
@@ -329,8 +323,6 @@ static int do_add_pages(void)
329 323
330 // until all the page lists contain enough pages 324 // until all the page lists contain enough pages
331 for (i=0; i< 1024*20;i++) { 325 for (i=0; i< 1024*20;i++) {
332 //while (smallest_nr_pages() < PAGES_PER_COLOR) {
333 // printk("smallest = %d\n", smallest_nr_pages());
334 page = alloc_page(GFP_HIGHUSER_MOVABLE); 326 page = alloc_page(GFP_HIGHUSER_MOVABLE);
335 327
336 if (unlikely(!page)) { 328 if (unlikely(!page)) {
@@ -340,55 +332,20 @@ static int do_add_pages(void)
340 } 332 }
341 color = page_list_index(page); 333 color = page_list_index(page);
342 counter[color]++; 334 counter[color]++;
343 // printk("page(%d) = color %x, bank %x, [color] =%d \n", color, page_color(page), page_bank(page), atomic_read(&color_groups[color].nr_pages)); 335 if (atomic_read(&color_groups[color].nr_pages) < PAGES_PER_COLOR && color>=0) {
344 //show_nr_pages();
345 //if (atomic_read(&color_groups[color].nr_pages) < PAGES_PER_COLOR && color>=16) {
346 if (atomic_read(&color_groups[color].nr_pages) < PAGES_PER_COLOR) {
347 //if ( PAGES_PER_COLOR && color>=16*2) {
348 add_page_to_color_list(page); 336 add_page_to_color_list(page);
349 // printk("add page(%d) = color %x, bank %x\n", color, page_color(page), page_bank(page)); 337 } else {
350 } else{
351 // Pages here will be freed later 338 // Pages here will be freed later
352 list_add_tail(&page->lru, &free_later); 339 list_add_tail(&page->lru, &free_later);
353 free_counter++; 340 free_counter++;
354 //list_del(&page->lru);
355 // __free_page(page);
356 // printk("useless page(%d) = color %x, bank %x\n", color, page_color(page), page_bank(page));
357 } 341 }
358 //show_nr_pages(); 342 }
359 /*
360 if(free_counter >= PAGES_PER_COLOR)
361 {
362 printk("free unwanted page list eariler");
363 free_counter = 0;
364 list_for_each_entry_safe(page, page_tmp, &free_later, lru) {
365 list_del(&page->lru);
366 __free_page(page);
367 }
368
369 show_nr_pages();
370 }
371 */
372 }
373/* printk("page counter = \n");
374 for (i=0; i<128; i++)
375 {
376 printk("(%03d) = %4d, ", i , counter[i]);
377 if(i%8 == 7){
378 printk("\n");
379 }
380 343
381 }
382*/
383 //printk("After refill : \n");
384 //show_nr_pages();
385#if 1
386 // Free the unwanted pages 344 // Free the unwanted pages
387 list_for_each_entry_safe(page, page_tmp, &free_later, lru) { 345 list_for_each_entry_safe(page, page_tmp, &free_later, lru) {
388 list_del(&page->lru); 346 list_del(&page->lru);
389 __free_page(page); 347 __free_page(page);
390 } 348 }
391#endif
392out: 349out:
393 return ret; 350 return ret;
394} 351}
@@ -407,7 +364,6 @@ static struct page *new_alloc_page_color( unsigned long color)
407 364
408 if( (color <0) || (color)>(number_cachecolors*number_banks -1)) { 365 if( (color <0) || (color)>(number_cachecolors*number_banks -1)) {
409 TRACE_CUR("Wrong color %lu\n", color); 366 TRACE_CUR("Wrong color %lu\n", color);
410// printk(KERN_WARNING "Wrong color %lu\n", color);
411 goto out; 367 goto out;
412 } 368 }
413 369
@@ -416,7 +372,6 @@ static struct page *new_alloc_page_color( unsigned long color)
416 spin_lock(&cgroup->lock); 372 spin_lock(&cgroup->lock);
417 if (unlikely(!atomic_read(&cgroup->nr_pages))) { 373 if (unlikely(!atomic_read(&cgroup->nr_pages))) {
418 TRACE_CUR("No free %lu colored pages.\n", color); 374 TRACE_CUR("No free %lu colored pages.\n", color);
419// printk(KERN_WARNING "no free %lu colored pages.\n", color);
420 goto out_unlock; 375 goto out_unlock;
421 } 376 }
422 rPage = list_first_entry(&cgroup->list, struct page, lru); 377 rPage = list_first_entry(&a