Lines Matching +full:non +full:- +full:negative

1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * Copyright (C) 2013-2014 Jens Axboe
18 * struct sbitmap_word - Word in a &struct sbitmap.
38 * struct sbitmap - Scalable bitmap.
40 * A &struct sbitmap is spread over multiple cachelines to avoid ping-pong. This
60 * @round_robin: Allocate bits in strict round-robin order.
72 * This is per-cpu, which allows multiple users to stick to different
82 * struct sbq_wait_state - Wait queue in a &struct sbitmap_queue.
97 * struct sbitmap_queue - Scalable bitmap with the added ability to wait on free
140 * sbitmap_init_node() - Initialize a &struct sbitmap on a specific memory node.
143 * @shift: Use 2^@shift bits per word in the bitmap; if a negative number if
153 * Return: Zero on success or negative errno on failure.
159 * sbitmap_free() - Free memory used by a &struct sbitmap.
164 free_percpu(sb->alloc_hint); in sbitmap_free()
165 kfree(sb->map); in sbitmap_free()
166 sb->map = NULL; in sbitmap_free()
170 * sbitmap_resize() - Resize a &struct sbitmap.
180 * sbitmap_get() - Try to allocate a free bit from a &struct sbitmap.
185 * Return: Non-negative allocated bit number if successful, -1 otherwise.
190 * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
196 * different allocation limits. E.g., there can be a high-priority class that
197 * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
198 * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority
200 * from starving out the high-priority class.
202 * Return: Non-negative allocated bit number if successful, -1 otherwise.
207 * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
214 #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift)
215 #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U))
220 * __sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap.
226 * This is inline even though it's non-trivial so that the function calls to the
237 if (start >= sb->depth) in __sbitmap_for_each_set()
242 while (scanned < sb->depth) { in __sbitmap_for_each_set()
245 sb->map[index].depth - nr, in __sbitmap_for_each_set()
246 sb->depth - scanned); in __sbitmap_for_each_set()
249 word = sb->map[index].word & ~sb->map[index].cleared; in __sbitmap_for_each_set()
263 if (!fn(sb, (index << sb->shift) + nr, data)) in __sbitmap_for_each_set()
270 if (++index >= sb->map_nr) in __sbitmap_for_each_set()
276 * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap.
290 return &sb->map[SB_NR_TO_INDEX(sb, bitnr)].word; in __sbitmap_word()
307 * sets the corresponding bit in the ->cleared mask instead. Paired with
309 * will clear the previously freed entries in the corresponding ->word.
313 unsigned long *addr = &sb->map[SB_NR_TO_INDEX(sb, bitnr)].cleared; in sbitmap_deferred_clear_bit()
326 if (likely(sb->alloc_hint && !sb->round_robin && bitnr < sb->depth)) in sbitmap_put()
327 *raw_cpu_ptr(sb->alloc_hint) = bitnr; in sbitmap_put()
347 shift--; in sbitmap_calculate_shift()
354 * sbitmap_show() - Dump &struct sbitmap information to a &struct seq_file.
364 * sbitmap_weight() - Return how many set and not cleared bits in a &struct
373 * sbitmap_bitmap_show() - Write a hex dump of a &struct sbitmap to a &struct
384 * sbitmap_queue_init_node() - Initialize a &struct sbitmap_queue on a specific
393 * Return: Zero on success or negative errno on failure.
399 * sbitmap_queue_free() - Free memory used by a &struct sbitmap_queue.
405 kfree(sbq->ws); in sbitmap_queue_free()
406 sbitmap_free(&sbq->sb); in sbitmap_queue_free()
410 * sbitmap_queue_resize() - Resize a &struct sbitmap_queue.
421 * __sbitmap_queue_get() - Try to allocate a free bit from a &struct
425 * Return: Non-negative allocated bit number if successful, -1 otherwise.
430 * __sbitmap_queue_get_shallow() - Try to allocate a free bit from a &struct
440 * Return: Non-negative allocated bit number if successful, -1 otherwise.
446 * sbitmap_queue_get() - Try to allocate a free bit from a &struct
452 * Return: Non-negative allocated bit number if successful, -1 otherwise.
466 * sbitmap_queue_get_shallow() - Try to allocate a free bit from a &struct
477 * Return: Non-negative allocated bit number if successful, -1 otherwise.
492 * sbitmap_queue_min_shallow_depth() - Inform a &struct sbitmap_queue of the
509 * sbitmap_queue_clear() - Free an allocated bit and wake up waiters on a
520 return (index + 1) & (SBQ_WAIT_QUEUES - 1); in sbq_index_inc()
531 * sbq_wait_ptr() - Get the next wait queue to use for a &struct
541 ws = &sbq->ws[atomic_read(wait_index)]; in sbq_wait_ptr()
547 * sbitmap_queue_wake_all() - Wake up everything waiting on a &struct
554 * sbitmap_queue_wake_up() - Wake up some of waiters in one waitqueue
561 * sbitmap_queue_show() - Dump &struct sbitmap_queue information to a &struct