aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:46 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 06:21:17 -0400
commit9a645fe1e634842fff554258da495b864ffd5c74 (patch)
treeffe7f4edfa88297a3302c494febfc246cf401ff6
parent013e33ea81d54ce418543a4a29a733504cb7b896 (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.h2
2 files changed, 62 insertions, 1 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 cc89ddefa926..0b76972f1893 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -40,7 +40,7 @@
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_DEADLINE 6 42#define SCHED_DEADLINE 6
43 43#define SCHED_LITMUS 7
44/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ 44/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
45#define SCHED_RESET_ON_FORK 0x40000000 45#define SCHED_RESET_ON_FORK 0x40000000
46 46