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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#ifndef _LITMUS_SCHED_GLOBAL_PLUGIN_H_
#include <linux/sched.h>
#include <litmus/litmus.h>
#include <litmus/sched_plugin.h>
#include <litmus/rt_domain.h>
#include <litmus/bheap.h>
/* cpu_entry_t - maintain the linked and scheduled state
*/
typedef struct {
int cpu;
struct task_struct* linked; /* only RT tasks */
struct task_struct* scheduled; /* only RT tasks */
struct bheap_node* hn;
} cpu_entry_t;
/*
For use by G-EDF family of plugins (G-EDF, EDZL, etc.).
These plugins differ mainly by actual rt_domain_t and
priority-order comparator functions and a few hooks for
timers.
*/
typedef int (*prio_compare_t)(struct task_struct*, struct task_struct*);
typedef struct task_struct* (*take_ready_t)(rt_domain_t* rt);
typedef void (*add_ready_t)(rt_domain_t* rt, struct task_struct *new);
typedef void (*job_arrival_t)(struct task_struct* task);
typedef void (*job_completion_t)(struct task_struct *t, int forced);
typedef int (*preemption_needed_t)(struct task_struct *t);
struct sched_global_plugin {
struct sched_plugin plugin;
/* function pointers MUST be set by plugin */
prio_compare_t prio_order;
take_ready_t take_ready;
add_ready_t add_ready;
job_arrival_t job_arrival;
job_completion_t job_completion;
preemption_needed_t preemption_needed;
rt_domain_t domain;
cpu_entry_t* cpus[NR_CPUS];
struct bheap_node heap_node[NR_CPUS];
struct bheap cpu_heap;
} __attribute__ ((__aligned__(SMP_CACHE_BYTES)));
extern struct sched_global_plugin* active_gbl_plugin;
/*
* "Member" functions for generic global scheduling.
* Will call down into "virtual" functions as needed.
*
* Use prefix "gbl_" (global)
*/
int gbl_ready_order(struct bheap_node* a, struct bheap_node* b);
int gbl_cpu_lower_prio(struct bheap_node *_a, struct bheap_node *_b);
void gbl_update_cpu_position(cpu_entry_t *entry);
cpu_entry_t* gbl_lowest_prio_cpu(void);
void gbl_link_task_to_cpu(struct task_struct* linked, cpu_entry_t *entry);
void gbl_unlink(struct task_struct* t);
void gbl_preempt(cpu_entry_t *entry);
void gbl_requeue(struct task_struct* task);
void gbl_update_queue_position(struct task_struct *task);
void gbl_check_for_preemptions(void);
void gbl_release_jobs(rt_domain_t* rt, struct bheap* tasks);
void gbl_job_completion(struct task_struct *t, int forced);
/* Think of these two functions as "static" member functions */
void gbl_domain_init(struct sched_global_plugin* gbl_plugin,
check_resched_needed_t resched,
release_jobs_t release);
long gbl_activate_plugin(void* plugin);
/*
* "Virtual member" functions for generic global scheduling.
* For use with sched_plugin or sched_global_plugin.
*
* Use prefix "gblv_" (global virtual)
*/
void gblv_job_arrival(struct task_struct* task);
int gblv_preemption_needed(struct task_struct *t);
void gblv_tick(struct task_struct* t);
struct task_struct* gblv_schedule(struct task_struct * prev);
void gblv_finish_switch(struct task_struct *prev);
void gblv_task_new(struct task_struct * t, int on_rq, int running);
void gblv_task_wake_up(struct task_struct *task);
void gblv_task_block(struct task_struct *t);
void gblv_task_exit(struct task_struct * t);
long gblv_admit_task(struct task_struct* tsk);
#endif
|