aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/sched_mc.h
blob: 95cd22cd72021be4bf4c5fae6512bcb4569d7915 (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
#ifndef _LINUX_SCHED_MC_H_
#define _LINUX_SCHED_MC_H_

/* criticality levels */
enum crit_level {
	/* probably don't need to assign these (paranoid) */
	CRIT_LEVEL_A = 0,
	CRIT_LEVEL_B = 1,
	CRIT_LEVEL_C = 2,
	NUM_CRIT_LEVELS = 3,
};

struct mc_task {
	enum crit_level crit;
	int lvl_a_id;
};

struct mc_job {
	int is_ghost:1;
	lt_t ghost_budget;
};

#ifdef __KERNEL__
/* only used in the kernel (no user space) */

struct mc_data {
	struct mc_task mc_task;
	struct mc_job mc_job;
};

#define tsk_mc_data(t)	 (tsk_rt(t)->mc_data)
#define tsk_mc_crit(t)	 (tsk_mc_data(t)->mc_task.crit)
#define is_ghost(t)	 (tsk_mc_data(t)->mc_job.is_ghost)

/*
 * Cache the budget along with the struct PID for a task so that we don't need
 * to fetch its task_struct every time we check to see what should be
 * scheduled.
 */
struct ce_dom_pid_entry {
	struct pid *pid;
	lt_t budget;
	/* accumulated (summed) budgets, including this one */
	lt_t acc_time;
	int expected_job;
};

struct ce_dom_data {
	int cpu;
	struct task_struct *scheduled, *should_schedule;
	/*
	 * Each CPU needs a mapping of level A ID (integer) to struct pid so
	 * that we can get its task struct.
	 */
	struct ce_dom_pid_entry pid_entries[CONFIG_PLUGIN_MC_LEVEL_A_MAX_TASKS];
	int num_pid_entries;
	lt_t cycle_time;
	struct hrtimer_start_on_info timer_info;
	struct hrtimer timer;
};

#endif /* __KERNEL__ */

#endif