aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/reservations/table_driven_ext_reservation.h
blob: bcc067416e6826dbf7240bdb41b253db4f0fd0de (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
#ifndef LITMUS_TD_RESERVATION_H
#define LITMUS_TD_RESERVATION_H

#include <litmus/reservations/ext_reservation.h>

/* ************************************************************************** */
struct mtd_reservation {
	struct ext_reservation res[NR_CPUS];
	lt_t major_cycle;
	unsigned int interval_index[NR_CPUS];
	unsigned int num_intervals[NR_CPUS];
	struct lt_interval* intervals[NR_CPUS];

	struct lt_interval cur_interval[NR_CPUS];
	lt_t major_cycle_start[NR_CPUS];
};

long mtd_res_install_table(
	struct mtd_reservation* mtd_res,
	struct lt_interval* intervals,
	lt_t major_cycle,
	unsigned int num_intervals,
	int cpu
);

long alloc_mtd_reservation(
	struct mtd_reservation** _res,
	unsigned int id,
	lt_t major_cycle
);

struct mtd_cpu_entry {
	int id;
	struct ext_reservation* scheduled;
	struct ext_reservation* linked;
	rt_domain_t domain;
};

/* environment for scheduling reservations via gedf */
struct mtd_reservation_environment {
	struct ext_reservation_environment env;

	/* max number of cpus in environment */
	int max_cpus;
	/* array of gedf cpu entries */
	struct mtd_cpu_entry* cpu_entries;

	raw_spinlock_t insert_lock;
};

long alloc_mtd_reservation_environment(
	struct mtd_reservation_environment** _env,
	int max_cpus
);

#endif