Lines Matching full:depth
14 unsigned depth = sb->depth; in init_alloc_hint() local
20 if (depth && !sb->round_robin) { in init_alloc_hint()
24 *per_cpu_ptr(sb->alloc_hint, i) = get_random_u32_below(depth); in init_alloc_hint()
30 unsigned int depth) in update_alloc_hint_before_get() argument
35 if (unlikely(hint >= depth)) { in update_alloc_hint_before_get()
36 hint = depth ? get_random_u32_below(depth) : 0; in update_alloc_hint_before_get()
44 unsigned int depth, in update_alloc_hint_after_get() argument
54 if (hint >= depth - 1) in update_alloc_hint_after_get()
64 unsigned int depth, unsigned int alloc_hint, bool wrap) in sbitmap_deferred_clear() argument
71 if (depth == 0) in sbitmap_deferred_clear()
74 word_mask = (~0UL) >> (BITS_PER_LONG - depth); in sbitmap_deferred_clear()
101 int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift, in sbitmap_init_node() argument
109 shift = sbitmap_calculate_shift(depth); in sbitmap_init_node()
116 sb->depth = depth; in sbitmap_init_node()
117 sb->map_nr = DIV_ROUND_UP(sb->depth, bits_per_word); in sbitmap_init_node()
120 if (depth == 0) { in sbitmap_init_node()
145 void sbitmap_resize(struct sbitmap *sb, unsigned int depth) in sbitmap_resize() argument
153 sb->depth = depth; in sbitmap_resize()
154 sb->map_nr = DIV_ROUND_UP(sb->depth, bits_per_word); in sbitmap_resize()
158 static int __sbitmap_get_word(unsigned long *word, unsigned long depth, in __sbitmap_get_word() argument
167 nr = find_next_zero_bit(word, depth, hint); in __sbitmap_get_word()
168 if (unlikely(nr >= depth)) { in __sbitmap_get_word()
185 if (hint >= depth - 1) in __sbitmap_get_word()
193 unsigned int depth, in sbitmap_find_bit_in_word() argument
200 nr = __sbitmap_get_word(&map->word, depth, in sbitmap_find_bit_in_word()
204 if (!sbitmap_deferred_clear(map, depth, alloc_hint, wrap)) in sbitmap_find_bit_in_word()
212 unsigned int depth, in sbitmap_find_bit() argument
224 depth), in sbitmap_find_bit()
264 unsigned int hint, depth; in sbitmap_get() local
269 depth = READ_ONCE(sb->depth); in sbitmap_get()
270 hint = update_alloc_hint_before_get(sb, depth); in sbitmap_get()
272 update_alloc_hint_after_get(sb, depth, hint, nr); in sbitmap_get()
293 unsigned int hint, depth; in sbitmap_get_shallow() local
298 depth = READ_ONCE(sb->depth); in sbitmap_get_shallow()
299 hint = update_alloc_hint_before_get(sb, depth); in sbitmap_get_shallow()
301 update_alloc_hint_after_get(sb, depth, hint, nr); in sbitmap_get_shallow()
348 seq_printf(m, "depth=%u\n", sb->depth); in sbitmap_show()
407 unsigned int depth) in sbq_calc_wake_batch() argument
414 * be a partial word. There are depth / bits_per_word full words and in sbq_calc_wake_batch()
415 * depth % bits_per_word bits left over. In bitwise arithmetic: in sbq_calc_wake_batch()
418 * depth / bits_per_word = depth >> shift in sbq_calc_wake_batch()
419 * depth % bits_per_word = depth & ((1 << shift) - 1) in sbq_calc_wake_batch()
424 depth = ((depth >> sbq->sb.shift) * shallow_depth + in sbq_calc_wake_batch()
425 min(depth & ((1U << sbq->sb.shift) - 1), shallow_depth)); in sbq_calc_wake_batch()
426 wake_batch = clamp_t(unsigned int, depth / SBQ_WAIT_QUEUES, 1, in sbq_calc_wake_batch()
432 int sbitmap_queue_init_node(struct sbitmap_queue *sbq, unsigned int depth, in sbitmap_queue_init_node() argument
438 ret = sbitmap_init_node(&sbq->sb, depth, shift, flags, node, in sbitmap_queue_init_node()
444 sbq->wake_batch = sbq_calc_wake_batch(sbq, depth); in sbitmap_queue_init_node()
464 unsigned int depth) in sbitmap_queue_update_wake_batch() argument
468 wake_batch = sbq_calc_wake_batch(sbq, depth); in sbitmap_queue_update_wake_batch()
477 unsigned int depth = (sbq->sb.depth + users - 1) / users; in sbitmap_queue_recalculate_wake_batch() local
479 wake_batch = clamp_val(depth / SBQ_WAIT_QUEUES, in sbitmap_queue_recalculate_wake_batch()
486 void sbitmap_queue_resize(struct sbitmap_queue *sbq, unsigned int depth) in sbitmap_queue_resize() argument
488 sbitmap_queue_update_wake_batch(sbq, depth); in sbitmap_queue_resize()
489 sbitmap_resize(&sbq->sb, depth); in sbitmap_queue_resize()
503 unsigned int hint, depth; in __sbitmap_queue_get_batch() local
510 depth = READ_ONCE(sb->depth); in __sbitmap_queue_get_batch()
511 hint = update_alloc_hint_before_get(sb, depth); in __sbitmap_queue_get_batch()
537 update_alloc_hint_after_get(sb, depth, hint, in __sbitmap_queue_get_batch()
564 sbitmap_queue_update_wake_batch(sbq, sbq->sb.depth); in sbitmap_queue_min_shallow_depth()
622 if (likely(!sb->round_robin && tag < sb->depth)) in sbitmap_update_cpu_hint()