aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-05-31 03:03:27 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-05-31 03:03:27 -0400
commitde76e27d43f69c6c143893b15eb1f830a11df053 (patch)
tree21d54838d720e0d4af04b5d81f5a022b2c4b16e0
parent4c0bcddb6feeef54cebca39385c1bda0392dee15 (diff)
Move budget-related helpers to budget.h
litmus.h is accumulating too many things. Since we already have budget.h, let's stick all budget-related inline functions there as well. This patch is merely cosmetic; it does not change how budget enforcement works.
-rw-r--r--include/litmus/budget.h19
-rw-r--r--include/litmus/litmus.h19
-rw-r--r--litmus/budget.c2
-rw-r--r--litmus/sched_cedf.c1
-rw-r--r--litmus/sched_gsn_edf.c1
-rw-r--r--litmus/sched_psn_edf.c1
6 files changed, 24 insertions, 19 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h
index 732530e63491..96da960adccc 100644
--- a/include/litmus/budget.h
+++ b/include/litmus/budget.h
@@ -5,4 +5,23 @@
5 * the next task. */ 5 * the next task. */
6void update_enforcement_timer(struct task_struct* t); 6void update_enforcement_timer(struct task_struct* t);
7 7
8inline static int budget_exhausted(struct task_struct* t)
9{
10 return get_exec_time(t) >= get_exec_cost(t);
11}
12
13inline static lt_t budget_remaining(struct task_struct* t)
14{
15 if (!budget_exhausted(t))
16 return get_exec_cost(t) - get_exec_time(t);
17 else
18 /* avoid overflow */
19 return 0;
20}
21
22#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
23
24#define budget_precisely_enforced(t) (tsk_rt(t)->task_params.budget_policy \
25 == PRECISE_ENFORCEMENT)
26
8#endif 27#endif
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
index 0b071fd359f9..160119abfe30 100644
--- a/include/litmus/litmus.h
+++ b/include/litmus/litmus.h
@@ -59,25 +59,6 @@ void litmus_exit_task(struct task_struct *tsk);
59#define is_priority_boosted(t) (tsk_rt(t)->priority_boosted) 59#define is_priority_boosted(t) (tsk_rt(t)->priority_boosted)
60#define get_boost_start(t) (tsk_rt(t)->boost_start_time) 60#define get_boost_start(t) (tsk_rt(t)->boost_start_time)
61 61
62inline static int budget_exhausted(struct task_struct* t)
63{
64 return get_exec_time(t) >= get_exec_cost(t);
65}
66
67inline static lt_t budget_remaining(struct task_struct* t)
68{
69 if (!budget_exhausted(t))
70 return get_exec_cost(t) - get_exec_time(t);
71 else
72 /* avoid overflow */
73 return 0;
74}
75
76#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
77
78#define budget_precisely_enforced(t) (tsk_rt(t)->task_params.budget_policy \
79 == PRECISE_ENFORCEMENT)
80
81#define is_hrt(t) \ 62#define is_hrt(t) \
82 (tsk_rt(t)->task_params.cls == RT_CLASS_HARD) 63 (tsk_rt(t)->task_params.cls == RT_CLASS_HARD)
83#define is_srt(t) \ 64#define is_srt(t) \
diff --git a/litmus/budget.c b/litmus/budget.c
index 310e9a3d4172..f7712be29adb 100644
--- a/litmus/budget.c
+++ b/litmus/budget.c
@@ -5,6 +5,8 @@
5#include <litmus/litmus.h> 5#include <litmus/litmus.h>
6#include <litmus/preempt.h> 6#include <litmus/preempt.h>
7 7
8#include <litmus/budget.h>
9
8struct enforcement_timer { 10struct enforcement_timer {
9 /* The enforcement timer is used to accurately police 11 /* The enforcement timer is used to accurately police
10 * slice budgets. */ 12 * slice budgets. */
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 480c62bc895b..caf7c52d2b84 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -35,6 +35,7 @@
35#include <litmus/litmus.h> 35#include <litmus/litmus.h>
36#include <litmus/jobs.h> 36#include <litmus/jobs.h>
37#include <litmus/preempt.h> 37#include <litmus/preempt.h>
38#include <litmus/budget.h>
38#include <litmus/sched_plugin.h> 39#include <litmus/sched_plugin.h>
39#include <litmus/edf_common.h> 40#include <litmus/edf_common.h>
40#include <litmus/sched_trace.h> 41#include <litmus/sched_trace.h>
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 6ed504f4750e..ea96a48b4185 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -21,6 +21,7 @@
21#include <litmus/trace.h> 21#include <litmus/trace.h>
22 22
23#include <litmus/preempt.h> 23#include <litmus/preempt.h>
24#include <litmus/budget.h>
24 25
25#include <litmus/bheap.h> 26#include <litmus/bheap.h>
26 27
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c
index 8e4a22dd8d6a..b0c8126bd44a 100644
--- a/litmus/sched_psn_edf.c
+++ b/litmus/sched_psn_edf.c
@@ -17,6 +17,7 @@
17#include <litmus/litmus.h> 17#include <litmus/litmus.h>
18#include <litmus/jobs.h> 18#include <litmus/jobs.h>
19#include <litmus/preempt.h> 19#include <litmus/preempt.h>
20#include <litmus/budget.h>
20#include <litmus/sched_plugin.h> 21#include <litmus/sched_plugin.h>
21#include <litmus/edf_common.h> 22#include <litmus/edf_common.h>
22#include <litmus/sched_trace.h> 23#include <litmus/sched_trace.h>