diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2011-06-22 01:30:25 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 12:04:53 -0400 |
commit | b4c52e27caa701a16e120b43a0e70ca6529a58a4 (patch) | |
tree | 677c7326db2a1334b28870c2cf4dc3a9795be08e /include/litmus/affinity.h | |
parent | b751e4e17e667f11404fc2f290416c0df050e964 (diff) |
C-EDF: Make migration affinity work with Release Master
Needed to update C-EDF to handle release master. Also
updated get_nearest_available_cpu() to take NO_CPU instead
of -1 to indicate that there is no release master. While
NO_CPU is 0xffffffff (-1 in two's complement), we still
translate this value to -1 in case NO_CPU changes.
Signed-off-by: Andrea Bastoni <bastoni@cs.unc.edu>
Diffstat (limited to 'include/litmus/affinity.h')
-rw-r--r-- | include/litmus/affinity.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/litmus/affinity.h b/include/litmus/affinity.h index 5eee0eaa170d..ca2e442eb547 100644 --- a/include/litmus/affinity.h +++ b/include/litmus/affinity.h | |||
@@ -24,12 +24,12 @@ void init_topology(void); /* called by Litmus module's _init_litmus() */ | |||
24 | 24 | ||
25 | /* Works like: | 25 | /* Works like: |
26 | void get_nearest_available_cpu( | 26 | void get_nearest_available_cpu( |
27 | cpu_entry_t* nearest, | 27 | cpu_entry_t **nearest, |
28 | cpu_entry_t* start, | 28 | cpu_entry_t *start, |
29 | cpu_entry_t* entries, | 29 | cpu_entry_t *entries, |
30 | int release_master) | 30 | int release_master) |
31 | 31 | ||
32 | Set release_master = -1 for no RM. | 32 | Set release_master = NO_CPU for no Release Master. |
33 | 33 | ||
34 | We use a macro here to exploit the fact that C-EDF and G-EDF | 34 | We use a macro here to exploit the fact that C-EDF and G-EDF |
35 | have similar structures for their cpu_entry_t structs, even though | 35 | have similar structures for their cpu_entry_t structs, even though |
@@ -48,13 +48,14 @@ dissertation.) | |||
48 | } else { \ | 48 | } else { \ |
49 | int __level; \ | 49 | int __level; \ |
50 | int __cpu; \ | 50 | int __cpu; \ |
51 | struct neighborhood* __neighbors = &neigh_info[(start)->cpu]; \ | 51 | int __release_master = ((release_master) == NO_CPU) ? -1 : (release_master); \ |
52 | struct neighborhood *__neighbors = &neigh_info[(start)->cpu]; \ | ||
52 | \ | 53 | \ |
53 | for (__level = 0; (__level < NUM_CACHE_LEVELS) && !(nearest); ++__level) { \ | 54 | for (__level = 0; (__level < NUM_CACHE_LEVELS) && !(nearest); ++__level) { \ |
54 | if (__neighbors->size[__level] > 1) { \ | 55 | if (__neighbors->size[__level] > 1) { \ |
55 | for_each_cpu(__cpu, __neighbors->neighbors[__level]) { \ | 56 | for_each_cpu(__cpu, __neighbors->neighbors[__level]) { \ |
56 | if (__cpu != (release_master)) { \ | 57 | if (__cpu != __release_master) { \ |
57 | cpu_entry_t* __entry = &per_cpu((entries), __cpu); \ | 58 | cpu_entry_t *__entry = &per_cpu((entries), __cpu); \ |
58 | if (!__entry->linked) { \ | 59 | if (!__entry->linked) { \ |
59 | (nearest) = __entry; \ | 60 | (nearest) = __entry; \ |
60 | break; \ | 61 | break; \ |