diff options
author | Glenn Elliott <gelliott@koruna.cs.unc.edu> | 2010-05-20 14:17:58 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@koruna.cs.unc.edu> | 2010-05-20 14:17:58 -0400 |
commit | e9c900fae35e4e4730469e189ff17bf30518346a (patch) | |
tree | 73d399b98f831fae4a7251a7d3d143ac044d6684 /src | |
parent | 09740315d4b914203c25c56e8f8909b4fae7b32d (diff) |
Support budget enforcement policies. Allows tasks to specify
how their execution budgets should be enforced: NO_ENFORCEMENT,
QUANTUM_ENFORCEMENT, and PRECISE_ENFORCEMENT (unsupported).
NOTE: Users of NO_ENFORCEMENT must call sleep_next_period() at the
end of every job to signal to the kernel that its job is complete.
Diffstat (limited to 'src')
-rw-r--r-- | src/litmus.c | 10 | ||||
-rw-r--r-- | src/task.c | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/litmus.c b/src/litmus.c index 5f98b97..f71f337 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
@@ -42,14 +42,16 @@ int be_migrate_to(int target_cpu) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, | 44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, |
45 | int cpu, task_class_t cls, int set_cpu_set) | 45 | int cpu, task_class_t cls, |
46 | budget_policy_t budget_policy, int set_cpu_set) | ||
46 | { | 47 | { |
47 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, | 48 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, |
48 | cpu, cls, set_cpu_set); | 49 | cpu, cls, budget_policy, set_cpu_set); |
49 | } | 50 | } |
50 | 51 | ||
51 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | 52 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, |
52 | int cpu, task_class_t cls, int set_cpu_set) | 53 | int cpu, task_class_t cls, |
54 | budget_policy_t budget_policy, int set_cpu_set) | ||
53 | { | 55 | { |
54 | struct rt_task param; | 56 | struct rt_task param; |
55 | int ret; | 57 | int ret; |
@@ -58,6 +60,8 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | |||
58 | param.cpu = cpu; | 60 | param.cpu = cpu; |
59 | param.cls = cls; | 61 | param.cls = cls; |
60 | param.phase = phase; | 62 | param.phase = phase; |
63 | param.budget_policy = budget_policy; | ||
64 | |||
61 | if (set_cpu_set) { | 65 | if (set_cpu_set) { |
62 | ret = be_migrate_to(cpu); | 66 | ret = be_migrate_to(cpu); |
63 | check("migrate to cpu"); | 67 | check("migrate to cpu"); |
@@ -49,6 +49,9 @@ int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period, | |||
49 | params.exec_cost = wcet; | 49 | params.exec_cost = wcet; |
50 | params.cls = class; | 50 | params.cls = class; |
51 | params.phase = 0; | 51 | params.phase = 0; |
52 | /* enforce budget for tasks that might not use sleep_next_period() */ | ||
53 | params.budget_policy = QUANTUM_ENFORCEMENT; | ||
54 | |||
52 | return __launch_rt_task(rt_prog, arg, | 55 | return __launch_rt_task(rt_prog, arg, |
53 | (rt_setup_fn_t) set_rt_task_param, ¶ms); | 56 | (rt_setup_fn_t) set_rt_task_param, ¶ms); |
54 | } | 57 | } |