Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 2 | |
Thomas Gleixner | e539d8f | 2008-06-05 10:28:00 +0200 | [diff] [blame] | 3 | #define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO + 2) |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 4 | |
Ingo Molnar | 97fb7a0 | 2018-03-03 14:01:12 +0100 | [diff] [blame] | 5 | #define CPUPRI_INVALID -1 |
| 6 | #define CPUPRI_IDLE 0 |
| 7 | #define CPUPRI_NORMAL 1 |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 8 | /* values 2-101 are RT priorities 0-99 */ |
| 9 | |
| 10 | struct cpupri_vec { |
Ingo Molnar | 97fb7a0 | 2018-03-03 14:01:12 +0100 | [diff] [blame] | 11 | atomic_t count; |
| 12 | cpumask_var_t mask; |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 13 | }; |
| 14 | |
| 15 | struct cpupri { |
Ingo Molnar | 97fb7a0 | 2018-03-03 14:01:12 +0100 | [diff] [blame] | 16 | struct cpupri_vec pri_to_cpu[CPUPRI_NR_PRIORITIES]; |
| 17 | int *cpu_to_pri; |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | #ifdef CONFIG_SMP |
Ingo Molnar | 97fb7a0 | 2018-03-03 14:01:12 +0100 | [diff] [blame] | 21 | int cpupri_find(struct cpupri *cp, struct task_struct *p, struct cpumask *lowest_mask); |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 22 | void cpupri_set(struct cpupri *cp, int cpu, int pri); |
Ingo Molnar | 97fb7a0 | 2018-03-03 14:01:12 +0100 | [diff] [blame] | 23 | int cpupri_init(struct cpupri *cp); |
Rusty Russell | 68e7456 | 2008-11-25 02:35:13 +1030 | [diff] [blame] | 24 | void cpupri_cleanup(struct cpupri *cp); |
Gregory Haskins | 6e0534f | 2008-05-12 21:21:01 +0200 | [diff] [blame] | 25 | #endif |