diff options
| author | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-05 00:31:08 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2014-02-24 14:01:11 -0500 |
| commit | 1f323b00f95c4704cdeea7918853f1e9e8d26c2e (patch) | |
| tree | 76a6856b2465ba7d114009f231c0dae9c9e5ef2c /bin | |
| parent | 871eef081ff9db7289a6947d0160cd984232c34c (diff) | |
Use /proc/litmus/domains to set up affinity masks
This patch replaces the algorithm used to compute CPU affinity masks.
The old algorithm was fragile and would break on systems with multiple
levels of shared caches. (As found on some older Intel chips, and as
one would probably find on a system with hyper-threading enabled.) The
bug stems from fact that Linux enumerates consecutive CPUs in a way
that distributes them across the physical system, thereby reducing
contention resources (e.g., cache).
Cluster size no longer needs to be provided now that cluster/CPU
mappings are explicit in /proc/litmus/domains/.
This keeps the following migration functions, but marks them as
deprecated:
- be_migrate_to_cluster()
- cluster_to_first_cpu()
- partition_to_cpu()
Although the deprecated interfaces are supported, the implementations
for these functions call the new be_migrate_to_domain() and
domain_to_first_cpu() functions.
[bbb: resolved several merge conflicts]
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/rt_launch.c | 10 | ||||
| -rw-r--r-- | bin/rtspin.c | 10 |
2 files changed, 6 insertions, 14 deletions
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index 93f10d5..5e29893 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
| @@ -42,7 +42,7 @@ void usage(char *error) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | #define OPTSTR "p:z:c:vwq:" | 45 | #define OPTSTR "p:c:vwq:" |
| 46 | 46 | ||
| 47 | int main(int argc, char** argv) | 47 | int main(int argc, char** argv) |
| 48 | { | 48 | { |
| @@ -51,7 +51,6 @@ int main(int argc, char** argv) | |||
| 51 | lt_t period; | 51 | lt_t period; |
| 52 | int migrate = 0; | 52 | int migrate = 0; |
| 53 | int cluster = 0; | 53 | int cluster = 0; |
| 54 | int cluster_size = 1; | ||
| 55 | int opt; | 54 | int opt; |
| 56 | int verbose = 0; | 55 | int verbose = 0; |
| 57 | int wait = 0; | 56 | int wait = 0; |
| @@ -71,9 +70,6 @@ int main(int argc, char** argv) | |||
| 71 | cluster = atoi(optarg); | 70 | cluster = atoi(optarg); |
| 72 | migrate = 1; | 71 | migrate = 1; |
| 73 | break; | 72 | break; |
| 74 | case 'z': | ||
| 75 | cluster_size = atoi(optarg); | ||
| 76 | break; | ||
| 77 | case 'q': | 73 | case 'q': |
| 78 | priority = atoi(optarg); | 74 | priority = atoi(optarg); |
| 79 | if (!litmus_is_valid_fixed_prio(priority)) | 75 | if (!litmus_is_valid_fixed_prio(priority)) |
| @@ -114,11 +110,11 @@ int main(int argc, char** argv) | |||
| 114 | info.argv = argv + optind + 2; | 110 | info.argv = argv + optind + 2; |
| 115 | info.wait = wait; | 111 | info.wait = wait; |
| 116 | if (migrate) { | 112 | if (migrate) { |
| 117 | ret = be_migrate_to_cluster(cluster, cluster_size); | 113 | ret = be_migrate_to_domain(cluster); |
| 118 | if (ret < 0) | 114 | if (ret < 0) |
| 119 | bail_out("could not migrate to target partition or cluster"); | 115 | bail_out("could not migrate to target partition or cluster"); |
| 120 | } | 116 | } |
| 121 | ret = __create_rt_task(launch, &info, cluster, cluster_size, wcet, period, | 117 | ret = __create_rt_task(launch, &info, cluster, wcet, period, |
| 122 | priority, class); | 118 | priority, class); |
| 123 | 119 | ||
| 124 | 120 | ||
diff --git a/bin/rtspin.c b/bin/rtspin.c index 167741d..b4156cc 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
| @@ -184,7 +184,7 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng | |||
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | #define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:" | 187 | #define OPTSTR "p:c:wlveo:f:s:q:X:L:Q:" |
| 188 | int main(int argc, char** argv) | 188 | int main(int argc, char** argv) |
| 189 | { | 189 | { |
| 190 | int ret; | 190 | int ret; |
| @@ -194,7 +194,6 @@ int main(int argc, char** argv) | |||
| 194 | unsigned int priority = LITMUS_LOWEST_PRIORITY; | 194 | unsigned int priority = LITMUS_LOWEST_PRIORITY; |
| 195 | int migrate = 0; | 195 | int migrate = 0; |
| 196 | int cluster = 0; | 196 | int cluster = 0; |
| 197 | int cluster_size = 1; | ||
| 198 | int opt; | 197 | int opt; |
| 199 | int wait = 0; | 198 | int wait = 0; |
| 200 | int test_loop = 0; | 199 | int test_loop = 0; |
| @@ -226,9 +225,6 @@ int main(int argc, char** argv) | |||
| 226 | cluster = atoi(optarg); | 225 | cluster = atoi(optarg); |
| 227 | migrate = 1; | 226 | migrate = 1; |
| 228 | break; | 227 | break; |
| 229 | case 'z': | ||
| 230 | cluster_size = atoi(optarg); | ||
| 231 | break; | ||
| 232 | case 'q': | 228 | case 'q': |
| 233 | priority = atoi(optarg); | 229 | priority = atoi(optarg); |
| 234 | if (!litmus_is_valid_fixed_prio(priority)) | 230 | if (!litmus_is_valid_fixed_prio(priority)) |
| @@ -326,7 +322,7 @@ int main(int argc, char** argv) | |||
| 326 | duration += period_ms * 0.001 * (num_jobs - 1); | 322 | duration += period_ms * 0.001 * (num_jobs - 1); |
| 327 | 323 | ||
| 328 | if (migrate) { | 324 | if (migrate) { |
| 329 | ret = be_migrate_to_cluster(cluster, cluster_size); | 325 | ret = be_migrate_to_domain(cluster); |
| 330 | if (ret < 0) | 326 | if (ret < 0) |
| 331 | bail_out("could not migrate to target partition or cluster."); | 327 | bail_out("could not migrate to target partition or cluster."); |
| 332 | } | 328 | } |
| @@ -339,7 +335,7 @@ int main(int argc, char** argv) | |||
| 339 | param.budget_policy = (want_enforcement) ? | 335 | param.budget_policy = (want_enforcement) ? |
| 340 | PRECISE_ENFORCEMENT : NO_ENFORCEMENT; | 336 | PRECISE_ENFORCEMENT : NO_ENFORCEMENT; |
| 341 | if (migrate) | 337 | if (migrate) |
| 342 | param.cpu = cluster_to_first_cpu(cluster, cluster_size); | 338 | param.cpu = domain_to_first_cpu(cluster); |
| 343 | ret = set_rt_task_param(gettid(), ¶m); | 339 | ret = set_rt_task_param(gettid(), ¶m); |
| 344 | if (ret < 0) | 340 | if (ret < 0) |
| 345 | bail_out("could not setup rt task params"); | 341 | bail_out("could not setup rt task params"); |
