| 1 |
|
| 2 | #include <linux/atomic.h>
|
| 3 | #include <linux/cpumask.h>
|
| 4 | #include <linux/sched/rt.h>
|
| 5 |
|
| 6 | #define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO+1)
|
| 7 |
|
| 8 | #define CPUPRI_INVALID -1
|
| 9 | #define CPUPRI_NORMAL 0
|
| 10 |
|
| 11 | #define CPUPRI_HIGHER 100
|
| 12 |
|
| 13 | struct cpupri_vec {
|
| 14 | atomic_t count;
|
| 15 | cpumask_var_t mask;
|
| 16 | };
|
| 17 |
|
| 18 | struct cpupri {
|
| 19 | struct cpupri_vec pri_to_cpu[CPUPRI_NR_PRIORITIES];
|
| 20 | int *cpu_to_pri;
|
| 21 | };
|
| 22 |
|
| 23 | int cpupri_find(struct cpupri *cp, struct task_struct *p,
|
| 24 | struct cpumask *lowest_mask);
|
| 25 | int cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
|
| 26 | struct cpumask *lowest_mask,
|
| 27 | bool (*fitness_fn)(struct task_struct *p, int cpu));
|
| 28 | void cpupri_set(struct cpupri *cp, int cpu, int pri);
|
| 29 | int cpupri_init(struct cpupri *cp);
|
| 30 | void cpupri_cleanup(struct cpupri *cp);
|