aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/reservations/gedf_reservation.h
blob: 578b9cad5838c886a45f689349074e964d940433 (plain) (blame)
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
#ifndef LITMUS_GEDF_RESERVATION_H
#define LITMUS_GEDF_RESERVATION_H

#include <linux/hrtimer.h>

#include <litmus/bheap.h>
#include <litmus/rt_domain.h>
#include <litmus/reservations/ext_reservation.h>

/* ************************************************************************** */
struct gedf_reservation {
	struct reservation res;
	struct gedf_cpu_entry* linked_on;
	struct gedf_cpu_entry* scheduled_on;
	lt_t cur_budget;
	int will_remove;
	int blocked;
};

struct gedf_cpu_entry {
	int id;
	struct bheap_node* hn;
	struct gedf_reservation* linked;
	struct gedf_reservation* scheduled;
};

struct gedf_task_reservation {
	struct gedf_reservation gedf_res;
	struct task_struct* task;
};

struct gedf_container_reservation {
	struct gedf_reservation gedf_res;
	lt_t max_budget;
	lt_t period;
	lt_t relative_deadline;
};

long alloc_gedf_container_reservation(
	struct gedf_container_reservation** _res,
	int id,
	lt_t max_budget,
	lt_t period,
	lt_t relative_deadline
);

long alloc_gedf_task_reservation(
	struct gedf_task_reservation** _res,
	struct task_struct* task
);

/* environment for scheduling reservations via gedf */
struct gedf_reservation_environment {
	struct reservation_environment env;

	/* list of all reservations scheduled by environment */
	struct list_head all_reservations;

	/* number of active cpus in reservation */
	volatile int num_cpus;

	/* array of gedf cpu entries */
	struct gedf_cpu_entry* cpu_entries;

	/* used to order cpus for gedf purposes */
	struct bheap cpu_heap;
	struct bheap_node* cpu_node;

	rt_domain_t domain;

#ifdef CONFIG_LITMUS_LOCKING
	/* reservations sleeping due to forbidden zones */
	int num_waiter_queues;
	wait_queue_head_t* fz_waiters;
#endif
};

long alloc_gedf_reservation_environment(
	struct gedf_reservation_environment** _env,
	int max_cpus
);

#endif