^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO + 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define CPUPRI_INVALID -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define CPUPRI_IDLE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define CPUPRI_NORMAL 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /* values 2-101 are RT priorities 0-99 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct cpupri_vec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) atomic_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) cpumask_var_t mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct cpupri {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct cpupri_vec pri_to_cpu[CPUPRI_NR_PRIORITIES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int *cpu_to_pri;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int cpupri_find(struct cpupri *cp, struct task_struct *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct cpumask *lowest_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct cpumask *lowest_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) bool (*fitness_fn)(struct task_struct *p, int cpu));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void cpupri_set(struct cpupri *cp, int cpu, int pri);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int cpupri_init(struct cpupri *cp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void cpupri_cleanup(struct cpupri *cp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #endif