From e4b2da0cecd9a43be71430b1f8e2fbbde07ea6ec Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Tue, 26 Jun 2012 10:47:54 +0200 Subject: Make use of kernel-provided FP macros Use the kernel's notion of fixed priorities. Also, add some clarifying comments to the task setup wrappers. --- bin/rtspin.c | 4 ++-- include/litmus.h | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/rtspin.c b/bin/rtspin.c index 87c178a..f0a477d 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c @@ -169,7 +169,7 @@ int main(int argc, char** argv) lt_t wcet; lt_t period; double wcet_ms, period_ms; - unsigned int priority = LITMUS_MIN_PRIORITY; + unsigned int priority = LITMUS_LOWEST_PRIORITY; int migrate = 0; int cpu = 0; int opt; @@ -197,7 +197,7 @@ int main(int argc, char** argv) break; case 'q': priority = atoi(optarg); - if (priority == 0 || priority > LITMUS_MAX_PRIORITY) + if (!litmus_is_valid_fixed_prio(priority)) usage("Invalid priority."); break; case 'c': diff --git a/include/litmus.h b/include/litmus.h index 232dcf5..3fa2a57 100644 --- a/include/litmus.h +++ b/include/litmus.h @@ -29,26 +29,34 @@ int get_rt_task_param(pid_t pid, struct rt_task* param); /* setup helper */ -/* times are given in ms */ +/* Times are given in ms. The 'priority' parameter + * is only relevant under fixed-priority scheduling (and + * ignored by other plugins). The task_class_t parameter + * is ignored by most plugins. + */ int sporadic_task( lt_t e, lt_t p, lt_t phase, int partition, unsigned int priority, task_class_t cls, budget_policy_t budget_policy, int set_cpu_set); -/* times are given in ns */ +/* Times are given in ns. The 'priority' parameter + * is only relevant under fixed-priority scheduling (and + * ignored by other plugins). The task_class_t parameter + * is ignored by most plugins. + */ int sporadic_task_ns( lt_t e, lt_t p, lt_t phase, int cpu, unsigned int priority, task_class_t cls, budget_policy_t budget_policy, int set_cpu_set); -/* budget enforcement off by default in these macros */ +/* Convenience macros. Budget enforcement off by default in these macros. */ #define sporadic_global(e, p) \ - sporadic_task(e, p, 0, 0, LITMUS_MAX_PRIORITY-1, \ + sporadic_task(e, p, 0, 0, LITMUS_LOWEST_PRIORITY, \ RT_CLASS_SOFT, NO_ENFORCEMENT, 0) #define sporadic_partitioned(e, p, cpu) \ - sporadic_task(e, p, 0, cpu, LITMUS_MAX_PRIORITY-1, \ + sporadic_task(e, p, 0, cpu, LITMUS_LOWEST_PRIORITY, \ RT_CLASS_SOFT, NO_ENFORCEMENT, 1) /* file descriptor attached shared objects support */ -- cgit v1.2.2