blob: d6cba0020064cc7a70a18d762adb3600dfed065f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Gregory Haskins6e0534f2008-05-12 21:21:01 +02002
Peter Zijlstrab13772f2020-10-14 21:39:04 +02003#define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO+1)
Gregory Haskins6e0534f2008-05-12 21:21:01 +02004
Ingo Molnar97fb7a02018-03-03 14:01:12 +01005#define CPUPRI_INVALID -1
Dietmar Eggemann5e054bc2020-09-22 10:39:33 +02006#define CPUPRI_NORMAL 0
Dietmar Eggemann1b087822020-09-22 10:39:34 +02007/* values 1-99 are for RT1-RT99 priorities */
Peter Zijlstrab13772f2020-10-14 21:39:04 +02008#define CPUPRI_HIGHER 100
Gregory Haskins6e0534f2008-05-12 21:21:01 +02009
10struct cpupri_vec {
Ingo Molnar97fb7a02018-03-03 14:01:12 +010011 atomic_t count;
12 cpumask_var_t mask;
Gregory Haskins6e0534f2008-05-12 21:21:01 +020013};
14
15struct cpupri {
Ingo Molnar97fb7a02018-03-03 14:01:12 +010016 struct cpupri_vec pri_to_cpu[CPUPRI_NR_PRIORITIES];
17 int *cpu_to_pri;
Gregory Haskins6e0534f2008-05-12 21:21:01 +020018};
19
20#ifdef CONFIG_SMP
Qais Yousef804d4022019-10-09 11:46:11 +010021int cpupri_find(struct cpupri *cp, struct task_struct *p,
Qais Yousefa1bd02e2020-03-02 13:27:18 +000022 struct cpumask *lowest_mask);
23int cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
24 struct cpumask *lowest_mask,
25 bool (*fitness_fn)(struct task_struct *p, int cpu));
Gregory Haskins6e0534f2008-05-12 21:21:01 +020026void cpupri_set(struct cpupri *cp, int cpu, int pri);
Ingo Molnar97fb7a02018-03-03 14:01:12 +010027int cpupri_init(struct cpupri *cp);
Rusty Russell68e74562008-11-25 02:35:13 +103028void cpupri_cleanup(struct cpupri *cp);
Gregory Haskins6e0534f2008-05-12 21:21:01 +020029#endif