-
Notifications
You must be signed in to change notification settings - Fork 1
/
hvdf.c
72 lines (57 loc) · 1.63 KB
/
hvdf.c
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
/* chronos/hvdf.c
*
* HVDF Single-Core Scheduler Module for ChronOS
*
* Author(s)
* - Nahush Gondhalekar nahushg@vt.edu
*
* Copyright (C) 2009-2012 Virginia Tech Real Time Systems Lab
*/
#include <linux/module.h>
#include <linux/chronos_types.h>
#include <linux/chronos_sched.h>
#include <linux/list.h>
struct rt_info* sched_hvdf(struct list_head *head, int flags)
{
struct rt_info *task, *best = local_task(head->next);
/*Check for each entry in the list*/
list_for_each_entry(task, head, task_list[LOCAL_LIST]){
/* Check if task is aborted, if yes, the return it. Otherwise
check if the deadline is blown, if yes, abort the task using
abort_thread(). {Done in handle_task_failure() function.}
*/
if(check_task_failure(task, flags))
return task;
/* Calculate inverse value density for the current task.*/
livd(task, false, flags);
/* Compare the inverse value densities and assign the higher value
density task to best.
*/
if(task->local_ivd < best->local_ivd)
best = task ;
}
if(flags & SCHED_FLAG_PI)
best = get_pi_task(best, head, flags);
return best;
}
struct rt_sched_local hvdf = {
.base.name = "HVDF",
.base.id = SCHED_RT_HVDF,
.flags = 0,
.schedule = sched_hvdf,
.base.sort_key = SORT_KEY_DEADLINE,
.base.list = LIST_HEAD_INIT(hvdf.base.list)
};
static int __init hvdf_init(void)
{
return add_local_scheduler(&hvdf);
}
module_init(hvdf_init);
static void __exit hvdf_exit(void)
{
remove_local_scheduler(&hvdf);
}
module_exit(hvdf_exit);
MODULE_DESCRIPTION("HVDF single-Core Scheduling Module for ChronOS");
MODULE_AUTHOR("Nahush Gondhalekar <nahushg@vt.edu>");
MODULE_LICENSE("GPL");