diff options
author | Jeremy Erickson <jerickso@cs.unc.edu> | 2012-08-30 21:01:47 -0400 |
---|---|---|
committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2012-08-30 21:01:47 -0400 |
commit | b1e1fea67bca3796d5f9133a92c300ec4fa93a4f (patch) | |
tree | 5cc1336e1fe1d6f93b1067e73e43381dd20db690 /include/litmus/sched_plugin.h | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) |
Bjoern's Dissertation Code with Priority Donationwip-splitting-omlp-jerickso
Diffstat (limited to 'include/litmus/sched_plugin.h')
-rw-r--r-- | include/litmus/sched_plugin.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/include/litmus/sched_plugin.h b/include/litmus/sched_plugin.h new file mode 100644 index 000000000000..b5d1ae7bc3b6 --- /dev/null +++ b/include/litmus/sched_plugin.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * Definition of the scheduler plugin interface. | ||
3 | * | ||
4 | */ | ||
5 | #ifndef _LINUX_SCHED_PLUGIN_H_ | ||
6 | #define _LINUX_SCHED_PLUGIN_H_ | ||
7 | |||
8 | #include <linux/sched.h> | ||
9 | |||
10 | #ifdef CONFIG_LITMUS_LOCKING | ||
11 | #include <litmus/locking.h> | ||
12 | #endif | ||
13 | |||
14 | /************************ setup/tear down ********************/ | ||
15 | |||
16 | typedef long (*activate_plugin_t) (void); | ||
17 | typedef long (*deactivate_plugin_t) (void); | ||
18 | |||
19 | |||
20 | |||
21 | /********************* scheduler invocation ******************/ | ||
22 | |||
23 | /* Plugin-specific realtime tick handler */ | ||
24 | typedef void (*scheduler_tick_t) (struct task_struct *cur); | ||
25 | /* Novell make sched decision function */ | ||
26 | typedef struct task_struct* (*schedule_t)(struct task_struct * prev); | ||
27 | /* Clean up after the task switch has occured. | ||
28 | * This function is called after every (even non-rt) task switch. | ||
29 | */ | ||
30 | typedef void (*finish_switch_t)(struct task_struct *prev); | ||
31 | |||
32 | |||
33 | /********************* task state changes ********************/ | ||
34 | |||
35 | /* Called to setup a new real-time task. | ||
36 | * Release the first job, enqueue, etc. | ||
37 | * Task may already be running. | ||
38 | */ | ||
39 | typedef void (*task_new_t) (struct task_struct *task, | ||
40 | int on_rq, | ||
41 | int running); | ||
42 | |||
43 | /* Called to re-introduce a task after blocking. | ||
44 | * Can potentially be called multiple times. | ||
45 | */ | ||
46 | typedef void (*task_wake_up_t) (struct task_struct *task); | ||
47 | /* called to notify the plugin of a blocking real-time task | ||
48 | * it will only be called for real-time tasks and before schedule is called */ | ||
49 | typedef void (*task_block_t) (struct task_struct *task); | ||
50 | /* Called when a real-time task exits or changes to a different scheduling | ||
51 | * class. | ||
52 | * Free any allocated resources | ||
53 | */ | ||
54 | typedef void (*task_exit_t) (struct task_struct *); | ||
55 | |||
56 | /* called early before the caller holds the runqueue lock */ | ||
57 | typedef void (*pre_setsched_t) (struct task_struct *, int policy); | ||
58 | |||
59 | |||
60 | /* Called when the current task attempts to create a new lock of a given | ||
61 | * protocol type. */ | ||
62 | typedef long (*allocate_lock_t) (struct litmus_lock **lock, int type, | ||
63 | void* __user config); | ||
64 | |||
65 | |||
66 | /********************* sys call backends ********************/ | ||
67 | /* This function causes the caller to sleep until the next release */ | ||
68 | typedef long (*complete_job_t) (void); | ||
69 | |||
70 | typedef long (*admit_task_t)(struct task_struct* tsk); | ||
71 | |||
72 | typedef void (*release_at_t)(struct task_struct *t, lt_t start); | ||
73 | |||
74 | struct sched_plugin { | ||
75 | struct list_head list; | ||
76 | /* basic info */ | ||
77 | char *plugin_name; | ||
78 | |||
79 | /* setup */ | ||
80 | activate_plugin_t activate_plugin; | ||
81 | deactivate_plugin_t deactivate_plugin; | ||
82 | |||
83 | /* scheduler invocation */ | ||
84 | scheduler_tick_t tick; | ||
85 | schedule_t schedule; | ||
86 | finish_switch_t finish_switch; | ||
87 | |||
88 | /* syscall backend */ | ||
89 | complete_job_t complete_job; | ||
90 | release_at_t release_at; | ||
91 | |||
92 | /* task state changes */ | ||
93 | admit_task_t admit_task; | ||
94 | |||
95 | task_new_t task_new; | ||
96 | task_wake_up_t task_wake_up; | ||
97 | task_block_t task_block; | ||
98 | task_exit_t task_exit; | ||
99 | |||
100 | pre_setsched_t pre_setsched; | ||
101 | |||
102 | #ifdef CONFIG_LITMUS_LOCKING | ||
103 | /* locking protocols */ | ||
104 | allocate_lock_t allocate_lock; | ||
105 | #endif | ||
106 | } __attribute__ ((__aligned__(SMP_CACHE_BYTES))); | ||
107 | |||
108 | |||
109 | extern struct sched_plugin *litmus; | ||
110 | |||
111 | int register_sched_plugin(struct sched_plugin* plugin); | ||
112 | struct sched_plugin* find_sched_plugin(const char* name); | ||
113 | int print_sched_plugins(char* buf, int max); | ||
114 | |||
115 | extern struct sched_plugin linux_sched_plugin; | ||
116 | |||
117 | #endif | ||