diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-24 18:27:03 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-24 18:27:03 -0400 |
commit | b876c5018c57a625e44dcb1a8a394307b53e681a (patch) | |
tree | 77520e733a78ab04bdede14d89b46e3796f35545 | |
parent | 4b0b3d1ca56686dae0201154b84a08ad1735ea16 (diff) |
Reset way tracker state between activations.
-rw-r--r-- | include/litmus/way_tracker.h | 1 | ||||
-rw-r--r-- | litmus/sched_mc.c | 5 | ||||
-rw-r--r-- | litmus/way_tracker.c | 18 |
3 files changed, 18 insertions, 6 deletions
diff --git a/include/litmus/way_tracker.h b/include/litmus/way_tracker.h index eb78f1deb208..cd61073725ed 100644 --- a/include/litmus/way_tracker.h +++ b/include/litmus/way_tracker.h | |||
@@ -5,6 +5,7 @@ | |||
5 | struct task_struct; | 5 | struct task_struct; |
6 | void color_page_info_take_ways(struct task_struct*); | 6 | void color_page_info_take_ways(struct task_struct*); |
7 | void color_page_info_release_ways(struct task_struct*); | 7 | void color_page_info_release_ways(struct task_struct*); |
8 | void reset_way_tracker(void); | ||
8 | 9 | ||
9 | 10 | ||
10 | #endif | 11 | #endif |
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 046359bfffdb..e52eb42a3610 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <litmus/ce_domain.h> | 29 | #include <litmus/ce_domain.h> |
30 | #include <litmus/dgl.h> | 30 | #include <litmus/dgl.h> |
31 | #include <litmus/color.h> | 31 | #include <litmus/color.h> |
32 | #include <litmus/way_tracker.h> | ||
32 | 33 | ||
33 | struct mc_signal { | 34 | struct mc_signal { |
34 | int update:1; | 35 | int update:1; |
@@ -1417,7 +1418,7 @@ static struct task_struct* mc_schedule(struct task_struct* prev) | |||
1417 | } | 1418 | } |
1418 | } | 1419 | } |
1419 | 1420 | ||
1420 | if (next && tsk_mc_crit(next) == CRIT_LEVEL_B && lock_cache) { | 1421 | if (next && tsk_mc_crit(next) == CRIT_LEVEL_B && lock_cache && get_rt_job(next) > 1) { |
1421 | start = litmus_clock(); | 1422 | start = litmus_clock(); |
1422 | work = color_sched_in_task(next); | 1423 | work = color_sched_in_task(next); |
1423 | tsk_rt(next)->load = litmus_clock() - start; | 1424 | tsk_rt(next)->load = litmus_clock() - start; |
@@ -1522,6 +1523,8 @@ static long mc_activate_plugin(void) | |||
1522 | int cpu, n = 0; | 1523 | int cpu, n = 0; |
1523 | long ret; | 1524 | long ret; |
1524 | 1525 | ||
1526 | reset_way_tracker(); | ||
1527 | |||
1525 | interrupt_cpu = atomic_read(&release_master_cpu); | 1528 | interrupt_cpu = atomic_read(&release_master_cpu); |
1526 | 1529 | ||
1527 | for_each_online_cpu(cpu) { | 1530 | for_each_online_cpu(cpu) { |
diff --git a/litmus/way_tracker.c b/litmus/way_tracker.c index 6afccc7ea5f7..a9e8ef62f37e 100644 --- a/litmus/way_tracker.c +++ b/litmus/way_tracker.c | |||
@@ -76,9 +76,20 @@ void color_page_info_release_ways(struct task_struct *t) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | void reset_way_tracker(void) | ||
80 | { | ||
81 | int color, unused; | ||
82 | |||
83 | for (color = 0; color < color_cache_info.nr_colors; ++color) { | ||
84 | unused = sizeof(unsigned long)*8 - color_cache_info.ways; | ||
85 | ways[color] = ULONG_MAX >> unused; | ||
86 | } | ||
87 | |||
88 | } | ||
89 | |||
79 | static int __init init_way_tracker(void) | 90 | static int __init init_way_tracker(void) |
80 | { | 91 | { |
81 | int color, size, unused; | 92 | int size; |
82 | 93 | ||
83 | BUG_ON(!color_cache_info.nr_colors); | 94 | BUG_ON(!color_cache_info.nr_colors); |
84 | BUG_ON(color_cache_info.ways > sizeof(unsigned long)*8); | 95 | BUG_ON(color_cache_info.ways > sizeof(unsigned long)*8); |
@@ -88,10 +99,7 @@ static int __init init_way_tracker(void) | |||
88 | size = sizeof(unsigned long) * color_cache_info.nr_colors; | 99 | size = sizeof(unsigned long) * color_cache_info.nr_colors; |
89 | ways = kmalloc(size, GFP_ATOMIC); | 100 | ways = kmalloc(size, GFP_ATOMIC); |
90 | 101 | ||
91 | for (color = 0; color < color_cache_info.nr_colors; ++color) { | 102 | reset_way_tracker(); |
92 | unused = sizeof(unsigned long)*8 - color_cache_info.ways; | ||
93 | ways[color] = ULONG_MAX >> unused; | ||
94 | } | ||
95 | 103 | ||
96 | raw_spin_lock_init(&lock); | 104 | raw_spin_lock_init(&lock); |
97 | 105 | ||