blob: 33344ee8d5f9a728689574d4ce5aa793f8bcd16c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef _LITMUS_BUDGET_H_
#define _LITMUS_BUDGET_H_
/* Update the per-processor enforcement timer (arm/reproram/cancel) for
* the next task. */
void update_enforcement_timer(struct task_struct* t);
inline static int budget_exhausted(struct task_struct* t)
{
return get_exec_time(t) >= get_exec_cost(t);
}
inline static lt_t budget_remaining(struct task_struct* t)
{
if (!budget_exhausted(t))
return get_exec_cost(t) - get_exec_time(t);
else
/* avoid overflow */
return 0;
}
#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
#define budget_precisely_enforced(t) (tsk_rt(t)->task_params.budget_policy \
== PRECISE_ENFORCEMENT)
static inline int requeue_preempted_job(struct task_struct* t)
{
/* Add task to ready queue only if not subject to budget enforcement or
* if the job has budget remaining. t may be NULL.
*/
return t && (!budget_exhausted(t) || !budget_enforced(t));
}
#endif
|