Lines Matching refs:cm

80 	struct cpumap *cm = this_cpu_ptr(m->maps);  in irq_matrix_online()  local
82 BUG_ON(cm->online); in irq_matrix_online()
84 if (!cm->initialized) { in irq_matrix_online()
85 cm->available = m->alloc_size; in irq_matrix_online()
86 cm->available -= cm->managed + m->systembits_inalloc; in irq_matrix_online()
87 cm->initialized = true; in irq_matrix_online()
89 m->global_available += cm->available; in irq_matrix_online()
90 cm->online = true; in irq_matrix_online()
101 struct cpumap *cm = this_cpu_ptr(m->maps); in irq_matrix_offline() local
104 m->global_available -= cm->available; in irq_matrix_offline()
105 cm->online = false; in irq_matrix_offline()
110 static unsigned int matrix_alloc_area(struct irq_matrix *m, struct cpumap *cm, in matrix_alloc_area() argument
116 bitmap_or(m->scratch_map, cm->managed_map, m->system_map, end); in matrix_alloc_area()
117 bitmap_or(m->scratch_map, m->scratch_map, cm->alloc_map, end); in matrix_alloc_area()
122 bitmap_set(cm->managed_map, area, num); in matrix_alloc_area()
124 bitmap_set(cm->alloc_map, area, num); in matrix_alloc_area()
133 struct cpumap *cm; in matrix_find_best_cpu() local
138 cm = per_cpu_ptr(m->maps, cpu); in matrix_find_best_cpu()
140 if (!cm->online || cm->available <= maxavl) in matrix_find_best_cpu()
144 maxavl = cm->available; in matrix_find_best_cpu()
154 struct cpumap *cm; in matrix_find_best_cpu_managed() local
159 cm = per_cpu_ptr(m->maps, cpu); in matrix_find_best_cpu_managed()
161 if (!cm->online || cm->managed_allocated > allocated) in matrix_find_best_cpu_managed()
165 allocated = cm->managed_allocated; in matrix_find_best_cpu_managed()
184 struct cpumap *cm = this_cpu_ptr(m->maps); in irq_matrix_assign_system() local
191 BUG_ON(!test_and_clear_bit(bit, cm->alloc_map)); in irq_matrix_assign_system()
192 cm->allocated--; in irq_matrix_assign_system()
215 struct cpumap *cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_reserve_managed() local
218 bit = matrix_alloc_area(m, cm, 1, true); in irq_matrix_reserve_managed()
221 cm->managed++; in irq_matrix_reserve_managed()
222 if (cm->online) { in irq_matrix_reserve_managed()
223 cm->available--; in irq_matrix_reserve_managed()
226 trace_irq_matrix_reserve_managed(bit, cpu, m, cm); in irq_matrix_reserve_managed()
256 struct cpumap *cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_remove_managed() local
259 if (WARN_ON_ONCE(!cm->managed)) in irq_matrix_remove_managed()
263 bitmap_andnot(m->scratch_map, cm->managed_map, cm->alloc_map, end); in irq_matrix_remove_managed()
269 clear_bit(bit, cm->managed_map); in irq_matrix_remove_managed()
271 cm->managed--; in irq_matrix_remove_managed()
272 if (cm->online) { in irq_matrix_remove_managed()
273 cm->available++; in irq_matrix_remove_managed()
276 trace_irq_matrix_remove_managed(bit, cpu, m, cm); in irq_matrix_remove_managed()
290 struct cpumap *cm; in irq_matrix_alloc_managed() local
299 cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_alloc_managed()
302 bitmap_andnot(m->scratch_map, cm->managed_map, cm->alloc_map, end); in irq_matrix_alloc_managed()
306 set_bit(bit, cm->alloc_map); in irq_matrix_alloc_managed()
307 cm->allocated++; in irq_matrix_alloc_managed()
308 cm->managed_allocated++; in irq_matrix_alloc_managed()
311 trace_irq_matrix_alloc_managed(bit, cpu, m, cm); in irq_matrix_alloc_managed()
324 struct cpumap *cm = this_cpu_ptr(m->maps); in irq_matrix_assign() local
328 if (WARN_ON_ONCE(test_and_set_bit(bit, cm->alloc_map))) in irq_matrix_assign()
330 cm->allocated++; in irq_matrix_assign()
332 cm->available--; in irq_matrix_assign()
334 trace_irq_matrix_assign(bit, smp_processor_id(), m, cm); in irq_matrix_assign()
381 struct cpumap *cm; in irq_matrix_alloc() local
394 cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_alloc()
395 bit = matrix_alloc_area(m, cm, 1, false); in irq_matrix_alloc()
398 cm->allocated++; in irq_matrix_alloc()
399 cm->available--; in irq_matrix_alloc()
405 trace_irq_matrix_alloc(bit, cpu, m, cm); in irq_matrix_alloc()
421 struct cpumap *cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_free() local
426 if (WARN_ON_ONCE(!test_and_clear_bit(bit, cm->alloc_map))) in irq_matrix_free()
429 cm->allocated--; in irq_matrix_free()
431 cm->managed_allocated--; in irq_matrix_free()
433 if (cm->online) in irq_matrix_free()
437 cm->available++; in irq_matrix_free()
438 if (cm->online) in irq_matrix_free()
441 trace_irq_matrix_free(bit, cpu, m, cm); in irq_matrix_free()
452 struct cpumap *cm = this_cpu_ptr(m->maps); in irq_matrix_available() local
456 return m->global_available - cm->available; in irq_matrix_available()
476 struct cpumap *cm = this_cpu_ptr(m->maps); in irq_matrix_allocated() local
478 return cm->allocated; in irq_matrix_allocated()
504 struct cpumap *cm = per_cpu_ptr(m->maps, cpu); in irq_matrix_debug_show() local
507 cpu, cm->available, cm->managed, in irq_matrix_debug_show()
508 cm->managed_allocated, cm->allocated, in irq_matrix_debug_show()
509 m->matrix_bits, cm->alloc_map); in irq_matrix_debug_show()