Lines Matching +full:trade +full:- +full:off

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (C) 2007-2008 Novell
27 * p->rt_priority p->prio newpri cpupri
29 * -1 -1 (CPUPRI_INVALID)
48 cpupri = CPUPRI_INVALID; /* -1 */ in convert_prio()
52 cpupri = MAX_RT_PRIO-1 - prio; /* 1 ... 99 */ in convert_prio()
55 case MAX_RT_PRIO-1: in convert_prio()
70 struct cpupri_vec *vec = &cp->pri_to_cpu[idx]; in __cpupri_find()
73 if (!atomic_read(&(vec)->count)) in __cpupri_find()
99 if (cpumask_any_and(&p->cpus_mask, vec->mask) >= nr_cpu_ids) in __cpupri_find()
103 cpumask_and(lowest_mask, &p->cpus_mask, vec->mask); in __cpupri_find()
110 * second reads of vec->mask. If we hit this in __cpupri_find()
128 * cpupri_find_fitness - find the best (lowest-pri) CPU in the system
142 * Return: (int)bool - CPUs were found
148 int task_pri = convert_prio(p->prio); in cpupri_find_fitness()
178 * If we failed to find a fitting lowest_mask, kick off a new search in cpupri_find_fitness()
186 * The cost of this trade-off is not entirely clear and will probably in cpupri_find_fitness()
189 * The main idea here is that if some CPUs were over-committed, we try in cpupri_find_fitness()
201 * cpupri_set - update the CPU priority setting
204 * @newpri: The priority (INVALID,NORMAL,RT1-RT99,HIGHER) to assign to this CPU
206 * Note: Assumes cpu_rq(cpu)->lock is locked
212 int *currpri = &cp->cpu_to_pri[cpu]; in cpupri_set()
230 struct cpupri_vec *vec = &cp->pri_to_cpu[newpri]; in cpupri_set()
232 cpumask_set_cpu(cpu, vec->mask); in cpupri_set()
239 atomic_inc(&(vec)->count); in cpupri_set()
243 struct cpupri_vec *vec = &cp->pri_to_cpu[oldpri]; in cpupri_set()
246 * Because the order of modification of the vec->count in cpupri_set()
264 atomic_dec(&(vec)->count); in cpupri_set()
266 cpumask_clear_cpu(cpu, vec->mask); in cpupri_set()
273 * cpupri_init - initialize the cpupri structure
276 * Return: -ENOMEM on memory allocation failure.
283 struct cpupri_vec *vec = &cp->pri_to_cpu[i]; in cpupri_init()
285 atomic_set(&vec->count, 0); in cpupri_init()
286 if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL)) in cpupri_init()
290 cp->cpu_to_pri = kcalloc(nr_cpu_ids, sizeof(int), GFP_KERNEL); in cpupri_init()
291 if (!cp->cpu_to_pri) in cpupri_init()
295 cp->cpu_to_pri[i] = CPUPRI_INVALID; in cpupri_init()
300 for (i--; i >= 0; i--) in cpupri_init()
301 free_cpumask_var(cp->pri_to_cpu[i].mask); in cpupri_init()
302 return -ENOMEM; in cpupri_init()
306 * cpupri_cleanup - clean up the cpupri structure
313 kfree(cp->cpu_to_pri); in cpupri_cleanup()
315 free_cpumask_var(cp->pri_to_cpu[i].mask); in cpupri_cleanup()