aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-25 00:31:46 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-08-07 03:46:44 -0400
commitc45f60d04ba20a48fd69378fdcb0c4e45020bd96 (patch)
tree20370d352f5d4cf6ffdf2881d6881fc3e2413637
parent16bd98f3efcbde0c48944e81a35270008edcd953 (diff)
Introduce main LITMUS^RT header
This patch adds a basic litmus/litmus.h, which is required for basic LITMUS^RT infrastructure to compile.
-rw-r--r--include/litmus/litmus.h61
-rw-r--r--include/uapi/linux/sched.h1
2 files changed, 62 insertions, 0 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
new file mode 100644
index 000000000000..c87863c9b231
--- /dev/null
+++ b/include/litmus/litmus.h
@@ -0,0 +1,61 @@
1/*
2 * Constant definitions related to
3 * scheduling policy.
4 */
5
6#ifndef _LINUX_LITMUS_H_
7#define _LINUX_LITMUS_H_
8
9#define is_realtime(t) ((t)->policy == SCHED_LITMUS)
10
11#define tsk_rt(t) (&(t)->rt_param)
12
13/* Realtime utility macros */
14#ifdef CONFIG_LITMUS_LOCKING
15#define is_priority_boosted(t) (tsk_rt(t)->priority_boosted)
16#define get_boost_start(t) (tsk_rt(t)->boost_start_time)
17#else
18#define is_priority_boosted(t) 0
19#define get_boost_start(t) 0
20#endif
21
22
23/* task_params macros */
24#define get_exec_cost(t) (tsk_rt(t)->task_params.exec_cost)
25#define get_rt_period(t) (tsk_rt(t)->task_params.period)
26#define get_rt_relative_deadline(t) (tsk_rt(t)->task_params.relative_deadline)
27#define get_rt_phase(t) (tsk_rt(t)->task_params.phase)
28#define get_partition(t) (tsk_rt(t)->task_params.cpu)
29#define get_priority(t) (tsk_rt(t)->task_params.priority)
30#define get_class(t) (tsk_rt(t)->task_params.cls)
31
32/* job_param macros */
33#define get_exec_time(t) (tsk_rt(t)->job_params.exec_time)
34#define get_deadline(t) (tsk_rt(t)->job_params.deadline)
35#define get_release(t) (tsk_rt(t)->job_params.release)
36#define get_lateness(t) (tsk_rt(t)->job_params.lateness)
37
38#define is_hrt(t) \
39 (tsk_rt(t)->task_params.cls == RT_CLASS_HARD)
40#define is_srt(t) \
41 (tsk_rt(t)->task_params.cls == RT_CLASS_SOFT)
42#define is_be(t) \
43 (tsk_rt(t)->task_params.cls == RT_CLASS_BEST_EFFORT)
44
45/* Our notion of time within LITMUS: kernel monotonic time. */
46static inline lt_t litmus_clock(void)
47{
48 return ktime_to_ns(ktime_get());
49}
50
51static inline struct control_page* get_control_page(struct task_struct *t)
52{
53 return tsk_rt(t)->ctrl_page;
54}
55
56static inline int has_control_page(struct task_struct* t)
57{
58 return tsk_rt(t)->ctrl_page != NULL;
59}
60
61#endif
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
index 5a0f945927ac..6a7b1b7cb48e 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -39,6 +39,7 @@
39#define SCHED_BATCH 3 39#define SCHED_BATCH 3
40/* SCHED_ISO: reserved but not implemented yet */ 40/* SCHED_ISO: reserved but not implemented yet */
41#define SCHED_IDLE 5 41#define SCHED_IDLE 5
42#define SCHED_LITMUS 6
42/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ 43/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
43#define SCHED_RESET_ON_FORK 0x40000000 44#define SCHED_RESET_ON_FORK 0x40000000
44 45