sbitmap.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Fast and scalable bitmaps.
  4. *
  5. * Copyright (C) 2016 Facebook
  6. * Copyright (C) 2013-2014 Jens Axboe
  7. */
  8. #ifndef __LINUX_SCALE_BITMAP_H
  9. #define __LINUX_SCALE_BITMAP_H
  10. #include <linux/atomic.h>
  11. #include <linux/bitops.h>
  12. #include <linux/cache.h>
  13. #include <linux/list.h>
  14. #include <linux/log2.h>
  15. #include <linux/minmax.h>
  16. #include <linux/percpu.h>
  17. #include <linux/slab.h>
  18. #include <linux/smp.h>
  19. #include <linux/types.h>
  20. #include <linux/wait.h>
  21. struct seq_file;
  22. /**
  23. * struct sbitmap_word - Word in a &struct sbitmap.
  24. */
  25. struct sbitmap_word {
  26. /**
  27. * @word: word holding free bits
  28. */
  29. unsigned long word;
  30. /**
  31. * @cleared: word holding cleared bits
  32. */
  33. unsigned long cleared ____cacheline_aligned_in_smp;
  34. } ____cacheline_aligned_in_smp;
  35. /**
  36. * struct sbitmap - Scalable bitmap.
  37. *
  38. * A &struct sbitmap is spread over multiple cachelines to avoid ping-pong. This
  39. * trades off higher memory usage for better scalability.
  40. */
  41. struct sbitmap {
  42. /**
  43. * @depth: Number of bits used in the whole bitmap.
  44. */
  45. unsigned int depth;
  46. /**
  47. * @shift: log2(number of bits used per word)
  48. */
  49. unsigned int shift;
  50. /**
  51. * @map_nr: Number of words (cachelines) being used for the bitmap.
  52. */
  53. unsigned int map_nr;
  54. /**
  55. * @round_robin: Allocate bits in strict round-robin order.
  56. */
  57. bool round_robin;
  58. /**
  59. * @map: Allocated bitmap.
  60. */
  61. struct sbitmap_word *map;
  62. /*
  63. * @alloc_hint: Cache of last successfully allocated or freed bit.
  64. *
  65. * This is per-cpu, which allows multiple users to stick to different
  66. * cachelines until the map is exhausted.
  67. */
  68. unsigned int __percpu *alloc_hint;
  69. };
  70. #define SBQ_WAIT_QUEUES 8
  71. #define SBQ_WAKE_BATCH 8
  72. /**
  73. * struct sbq_wait_state - Wait queue in a &struct sbitmap_queue.
  74. */
  75. struct sbq_wait_state {
  76. /**
  77. * @wait: Wait queue.
  78. */
  79. wait_queue_head_t wait;
  80. } ____cacheline_aligned_in_smp;
  81. /**
  82. * struct sbitmap_queue - Scalable bitmap with the added ability to wait on free
  83. * bits.
  84. *
  85. * A &struct sbitmap_queue uses multiple wait queues and rolling wakeups to
  86. * avoid contention on the wait queue spinlock. This ensures that we don't hit a
  87. * scalability wall when we run out of free bits and have to start putting tasks
  88. * to sleep.
  89. */
  90. struct sbitmap_queue {
  91. /**
  92. * @sb: Scalable bitmap.
  93. */
  94. struct sbitmap sb;
  95. /**
  96. * @wake_batch: Number of bits which must be freed before we wake up any
  97. * waiters.
  98. */
  99. unsigned int wake_batch;
  100. /**
  101. * @wake_index: Next wait queue in @ws to wake up.
  102. */
  103. atomic_t wake_index;
  104. /**
  105. * @ws: Wait queues.
  106. */
  107. struct sbq_wait_state *ws;
  108. /*
  109. * @ws_active: count of currently active ws waitqueues
  110. */
  111. atomic_t ws_active;
  112. /**
  113. * @min_shallow_depth: The minimum shallow depth which may be passed to
  114. * sbitmap_queue_get_shallow()
  115. */
  116. unsigned int min_shallow_depth;
  117. /**
  118. * @completion_cnt: Number of bits cleared passed to the
  119. * wakeup function.
  120. */
  121. atomic_t completion_cnt;
  122. /**
  123. * @wakeup_cnt: Number of thread wake ups issued.
  124. */
  125. atomic_t wakeup_cnt;
  126. };
  127. /**
  128. * sbitmap_init_node() - Initialize a &struct sbitmap on a specific memory node.
  129. * @sb: Bitmap to initialize.
  130. * @depth: Number of bits to allocate.
  131. * @shift: Use 2^@shift bits per word in the bitmap; if a negative number if
  132. * given, a good default is chosen.
  133. * @flags: Allocation flags.
  134. * @node: Memory node to allocate on.
  135. * @round_robin: If true, be stricter about allocation order; always allocate
  136. * starting from the last allocated bit. This is less efficient
  137. * than the default behavior (false).
  138. * @alloc_hint: If true, apply percpu hint for where to start searching for
  139. * a free bit.
  140. *
  141. * Return: Zero on success or negative errno on failure.
  142. */
  143. int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
  144. gfp_t flags, int node, bool round_robin, bool alloc_hint);
  145. /* sbitmap internal helper */
  146. static inline unsigned int __map_depth(const struct sbitmap *sb, int index)
  147. {
  148. if (index == sb->map_nr - 1)
  149. return sb->depth - (index << sb->shift);
  150. return 1U << sb->shift;
  151. }
  152. /**
  153. * sbitmap_free() - Free memory used by a &struct sbitmap.
  154. * @sb: Bitmap to free.
  155. */
  156. static inline void sbitmap_free(struct sbitmap *sb)
  157. {
  158. free_percpu(sb->alloc_hint);
  159. kvfree(sb->map);
  160. sb->map = NULL;
  161. }
  162. /**
  163. * sbitmap_resize() - Resize a &struct sbitmap.
  164. * @sb: Bitmap to resize.
  165. * @depth: New number of bits to resize to.
  166. *
  167. * Doesn't reallocate anything. It's up to the caller to ensure that the new
  168. * depth doesn't exceed the depth that the sb was initialized with.
  169. */
  170. void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
  171. /**
  172. * sbitmap_get() - Try to allocate a free bit from a &struct sbitmap.
  173. * @sb: Bitmap to allocate from.
  174. *
  175. * This operation provides acquire barrier semantics if it succeeds.
  176. *
  177. * Return: Non-negative allocated bit number if successful, -1 otherwise.
  178. */
  179. int sbitmap_get(struct sbitmap *sb);
  180. /**
  181. * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
  182. * limiting the depth used from each word.
  183. * @sb: Bitmap to allocate from.
  184. * @shallow_depth: The maximum number of bits to allocate from a single word.
  185. *
  186. * This rather specific operation allows for having multiple users with
  187. * different allocation limits. E.g., there can be a high-priority class that
  188. * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
  189. * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority
  190. * class can only allocate half of the total bits in the bitmap, preventing it
  191. * from starving out the high-priority class.
  192. *
  193. * Return: Non-negative allocated bit number if successful, -1 otherwise.
  194. */
  195. int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth);
  196. /**
  197. * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
  198. * @sb: Bitmap to check.
  199. *
  200. * Return: true if any bit in the bitmap is set, false otherwise.
  201. */
  202. bool sbitmap_any_bit_set(const struct sbitmap *sb);
  203. #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift)
  204. #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U))
  205. typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *);
  206. /**
  207. * __sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap.
  208. * @start: Where to start the iteration.
  209. * @sb: Bitmap to iterate over.
  210. * @fn: Callback. Should return true to continue or false to break early.
  211. * @data: Pointer to pass to callback.
  212. *
  213. * This is inline even though it's non-trivial so that the function calls to the
  214. * callback will hopefully get optimized away.
  215. */
  216. static inline void __sbitmap_for_each_set(struct sbitmap *sb,
  217. unsigned int start,
  218. sb_for_each_fn fn, void *data)
  219. {
  220. unsigned int index;
  221. unsigned int nr;
  222. unsigned int scanned = 0;
  223. if (start >= sb->depth)
  224. start = 0;
  225. index = SB_NR_TO_INDEX(sb, start);
  226. nr = SB_NR_TO_BIT(sb, start);
  227. while (scanned < sb->depth) {
  228. unsigned long word;
  229. unsigned int depth = min_t(unsigned int,
  230. __map_depth(sb, index) - nr,
  231. sb->depth - scanned);
  232. scanned += depth;
  233. word = sb->map[index].word & ~sb->map[index].cleared;
  234. if (!word)
  235. goto next;
  236. /*
  237. * On the first iteration of the outer loop, we need to add the
  238. * bit offset back to the size of the word for find_next_bit().
  239. * On all other iterations, nr is zero, so this is a noop.
  240. */
  241. depth += nr;
  242. while (1) {
  243. nr = find_next_bit(&word, depth, nr);
  244. if (nr >= depth)
  245. break;
  246. if (!fn(sb, (index << sb->shift) + nr, data))
  247. return;
  248. nr++;
  249. }
  250. next:
  251. nr = 0;
  252. if (++index >= sb->map_nr)
  253. index = 0;
  254. }
  255. }
  256. /**
  257. * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap.
  258. * @sb: Bitmap to iterate over.
  259. * @fn: Callback. Should return true to continue or false to break early.
  260. * @data: Pointer to pass to callback.
  261. */
  262. static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn,
  263. void *data)
  264. {
  265. __sbitmap_for_each_set(sb, 0, fn, data);
  266. }
  267. static inline unsigned long *__sbitmap_word(struct sbitmap *sb,
  268. unsigned int bitnr)
  269. {
  270. return &sb->map[SB_NR_TO_INDEX(sb, bitnr)].word;
  271. }
  272. /* Helpers equivalent to the operations in asm/bitops.h and linux/bitmap.h */
  273. static inline void sbitmap_set_bit(struct sbitmap *sb, unsigned int bitnr)
  274. {
  275. set_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr));
  276. }
  277. static inline void sbitmap_clear_bit(struct sbitmap *sb, unsigned int bitnr)
  278. {
  279. clear_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr));
  280. }
  281. /*
  282. * This one is special, since it doesn't actually clear the bit, rather it
  283. * sets the corresponding bit in the ->cleared mask instead. Paired with
  284. * the caller doing sbitmap_deferred_clear() if a given index is full, which
  285. * will clear the previously freed entries in the corresponding ->word.
  286. */
  287. static inline void sbitmap_deferred_clear_bit(struct sbitmap *sb, unsigned int bitnr)
  288. {
  289. unsigned long *addr = &sb->map[SB_NR_TO_INDEX(sb, bitnr)].cleared;
  290. set_bit(SB_NR_TO_BIT(sb, bitnr), addr);
  291. }
  292. /*
  293. * Pair of sbitmap_get, and this one applies both cleared bit and
  294. * allocation hint.
  295. */
  296. static inline void sbitmap_put(struct sbitmap *sb, unsigned int bitnr)
  297. {
  298. sbitmap_deferred_clear_bit(sb, bitnr);
  299. if (likely(sb->alloc_hint && !sb->round_robin && bitnr < sb->depth))
  300. *raw_cpu_ptr(sb->alloc_hint) = bitnr;
  301. }
  302. static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr)
  303. {
  304. return test_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr));
  305. }
  306. static inline int sbitmap_calculate_shift(unsigned int depth)
  307. {
  308. int shift = ilog2(BITS_PER_LONG);
  309. /*
  310. * If the bitmap is small, shrink the number of bits per word so
  311. * we spread over a few cachelines, at least. If less than 4
  312. * bits, just forget about it, it's not going to work optimally
  313. * anyway.
  314. */
  315. if (depth >= 4) {
  316. while ((4U << shift) > depth)
  317. shift--;
  318. }
  319. return shift;
  320. }
  321. /**
  322. * sbitmap_show() - Dump &struct sbitmap information to a &struct seq_file.
  323. * @sb: Bitmap to show.
  324. * @m: struct seq_file to write to.
  325. *
  326. * This is intended for debugging. The format may change at any time.
  327. */
  328. void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
  329. /**
  330. * sbitmap_weight() - Return how many set and not cleared bits in a &struct
  331. * sbitmap.
  332. * @sb: Bitmap to check.
  333. *
  334. * Return: How many set and not cleared bits set
  335. */
  336. unsigned int sbitmap_weight(const struct sbitmap *sb);
  337. /**
  338. * sbitmap_bitmap_show() - Write a hex dump of a &struct sbitmap to a &struct
  339. * seq_file.
  340. * @sb: Bitmap to show.
  341. * @m: struct seq_file to write to.
  342. *
  343. * This is intended for debugging. The output isn't guaranteed to be internally
  344. * consistent.
  345. */
  346. void sbitmap_bitmap_show(struct sbitmap *sb, struct seq_file *m);
  347. /**
  348. * sbitmap_queue_init_node() - Initialize a &struct sbitmap_queue on a specific
  349. * memory node.
  350. * @sbq: Bitmap queue to initialize.
  351. * @depth: See sbitmap_init_node().
  352. * @shift: See sbitmap_init_node().
  353. * @round_robin: See sbitmap_get().
  354. * @flags: Allocation flags.
  355. * @node: Memory node to allocate on.
  356. *
  357. * Return: Zero on success or negative errno on failure.
  358. */
  359. int sbitmap_queue_init_node(struct sbitmap_queue *sbq, unsigned int depth,
  360. int shift, bool round_robin, gfp_t flags, int node);
  361. /**
  362. * sbitmap_queue_free() - Free memory used by a &struct sbitmap_queue.
  363. *
  364. * @sbq: Bitmap queue to free.
  365. */
  366. static inline void sbitmap_queue_free(struct sbitmap_queue *sbq)
  367. {
  368. kfree(sbq->ws);
  369. sbitmap_free(&sbq->sb);
  370. }
  371. /**
  372. * sbitmap_queue_recalculate_wake_batch() - Recalculate wake batch
  373. * @sbq: Bitmap queue to recalculate wake batch.
  374. * @users: Number of shares.
  375. *
  376. * Like sbitmap_queue_update_wake_batch(), this will calculate wake batch
  377. * by depth. This interface is for HCTX shared tags or queue shared tags.
  378. */
  379. void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq,
  380. unsigned int users);
  381. /**
  382. * sbitmap_queue_resize() - Resize a &struct sbitmap_queue.
  383. * @sbq: Bitmap queue to resize.
  384. * @depth: New number of bits to resize to.
  385. *
  386. * Like sbitmap_resize(), this doesn't reallocate anything. It has to do
  387. * some extra work on the &struct sbitmap_queue, so it's not safe to just
  388. * resize the underlying &struct sbitmap.
  389. */
  390. void sbitmap_queue_resize(struct sbitmap_queue *sbq, unsigned int depth);
  391. /**
  392. * __sbitmap_queue_get() - Try to allocate a free bit from a &struct
  393. * sbitmap_queue with preemption already disabled.
  394. * @sbq: Bitmap queue to allocate from.
  395. *
  396. * Return: Non-negative allocated bit number if successful, -1 otherwise.
  397. */
  398. int __sbitmap_queue_get(struct sbitmap_queue *sbq);
  399. /**
  400. * __sbitmap_queue_get_batch() - Try to allocate a batch of free bits
  401. * @sbq: Bitmap queue to allocate from.
  402. * @nr_tags: number of tags requested
  403. * @offset: offset to add to returned bits
  404. *
  405. * Return: Mask of allocated tags, 0 if none are found. Each tag allocated is
  406. * a bit in the mask returned, and the caller must add @offset to the value to
  407. * get the absolute tag value.
  408. */
  409. unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,
  410. unsigned int *offset);
  411. /**
  412. * sbitmap_queue_get_shallow() - Try to allocate a free bit from a &struct
  413. * sbitmap_queue, limiting the depth used from each word, with preemption
  414. * already disabled.
  415. * @sbq: Bitmap queue to allocate from.
  416. * @shallow_depth: The maximum number of bits to allocate from a single word.
  417. * See sbitmap_get_shallow().
  418. *
  419. * If you call this, make sure to call sbitmap_queue_min_shallow_depth() after
  420. * initializing @sbq.
  421. *
  422. * Return: Non-negative allocated bit number if successful, -1 otherwise.
  423. */
  424. int sbitmap_queue_get_shallow(struct sbitmap_queue *sbq,
  425. unsigned int shallow_depth);
  426. /**
  427. * sbitmap_queue_get() - Try to allocate a free bit from a &struct
  428. * sbitmap_queue.
  429. * @sbq: Bitmap queue to allocate from.
  430. * @cpu: Output parameter; will contain the CPU we ran on (e.g., to be passed to
  431. * sbitmap_queue_clear()).
  432. *
  433. * Return: Non-negative allocated bit number if successful, -1 otherwise.
  434. */
  435. static inline int sbitmap_queue_get(struct sbitmap_queue *sbq,
  436. unsigned int *cpu)
  437. {
  438. int nr;
  439. *cpu = get_cpu();
  440. nr = __sbitmap_queue_get(sbq);
  441. put_cpu();
  442. return nr;
  443. }
  444. /**
  445. * sbitmap_queue_min_shallow_depth() - Inform a &struct sbitmap_queue of the
  446. * minimum shallow depth that will be used.
  447. * @sbq: Bitmap queue in question.
  448. * @min_shallow_depth: The minimum shallow depth that will be passed to
  449. * sbitmap_queue_get_shallow() or __sbitmap_queue_get_shallow().
  450. *
  451. * sbitmap_queue_clear() batches wakeups as an optimization. The batch size
  452. * depends on the depth of the bitmap. Since the shallow allocation functions
  453. * effectively operate with a different depth, the shallow depth must be taken
  454. * into account when calculating the batch size. This function must be called
  455. * with the minimum shallow depth that will be used. Failure to do so can result
  456. * in missed wakeups.
  457. */
  458. void sbitmap_queue_min_shallow_depth(struct sbitmap_queue *sbq,
  459. unsigned int min_shallow_depth);
  460. /**
  461. * sbitmap_queue_clear() - Free an allocated bit and wake up waiters on a
  462. * &struct sbitmap_queue.
  463. * @sbq: Bitmap to free from.
  464. * @nr: Bit number to free.
  465. * @cpu: CPU the bit was allocated on.
  466. */
  467. void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
  468. unsigned int cpu);
  469. /**
  470. * sbitmap_queue_clear_batch() - Free a batch of allocated bits
  471. * &struct sbitmap_queue.
  472. * @sbq: Bitmap to free from.
  473. * @offset: offset for each tag in array
  474. * @tags: array of tags
  475. * @nr_tags: number of tags in array
  476. */
  477. void sbitmap_queue_clear_batch(struct sbitmap_queue *sbq, int offset,
  478. int *tags, int nr_tags);
  479. static inline int sbq_index_inc(int index)
  480. {
  481. return (index + 1) & (SBQ_WAIT_QUEUES - 1);
  482. }
  483. static inline void sbq_index_atomic_inc(atomic_t *index)
  484. {
  485. int old = atomic_read(index);
  486. int new = sbq_index_inc(old);
  487. atomic_cmpxchg(index, old, new);
  488. }
  489. /**
  490. * sbq_wait_ptr() - Get the next wait queue to use for a &struct
  491. * sbitmap_queue.
  492. * @sbq: Bitmap queue to wait on.
  493. * @wait_index: A counter per "user" of @sbq.
  494. */
  495. static inline struct sbq_wait_state *sbq_wait_ptr(struct sbitmap_queue *sbq,
  496. atomic_t *wait_index)
  497. {
  498. struct sbq_wait_state *ws;
  499. ws = &sbq->ws[atomic_read(wait_index)];
  500. sbq_index_atomic_inc(wait_index);
  501. return ws;
  502. }
  503. /**
  504. * sbitmap_queue_wake_all() - Wake up everything waiting on a &struct
  505. * sbitmap_queue.
  506. * @sbq: Bitmap queue to wake up.
  507. */
  508. void sbitmap_queue_wake_all(struct sbitmap_queue *sbq);
  509. /**
  510. * sbitmap_queue_wake_up() - Wake up some of waiters in one waitqueue
  511. * on a &struct sbitmap_queue.
  512. * @sbq: Bitmap queue to wake up.
  513. * @nr: Number of bits cleared.
  514. */
  515. void sbitmap_queue_wake_up(struct sbitmap_queue *sbq, int nr);
  516. /**
  517. * sbitmap_queue_show() - Dump &struct sbitmap_queue information to a &struct
  518. * seq_file.
  519. * @sbq: Bitmap queue to show.
  520. * @m: struct seq_file to write to.
  521. *
  522. * This is intended for debugging. The format may change at any time.
  523. */
  524. void sbitmap_queue_show(struct sbitmap_queue *sbq, struct seq_file *m);
  525. struct sbq_wait {
  526. struct sbitmap_queue *sbq; /* if set, sbq_wait is accounted */
  527. struct wait_queue_entry wait;
  528. };
  529. #define DEFINE_SBQ_WAIT(name) \
  530. struct sbq_wait name = { \
  531. .sbq = NULL, \
  532. .wait = { \
  533. .private = current, \
  534. .func = autoremove_wake_function, \
  535. .entry = LIST_HEAD_INIT((name).wait.entry), \
  536. } \
  537. }
  538. /*
  539. * Wrapper around prepare_to_wait_exclusive(), which maintains some extra
  540. * internal state.
  541. */
  542. void sbitmap_prepare_to_wait(struct sbitmap_queue *sbq,
  543. struct sbq_wait_state *ws,
  544. struct sbq_wait *sbq_wait, int state);
  545. /*
  546. * Must be paired with sbitmap_prepare_to_wait().
  547. */
  548. void sbitmap_finish_wait(struct sbitmap_queue *sbq, struct sbq_wait_state *ws,
  549. struct sbq_wait *sbq_wait);
  550. /*
  551. * Wrapper around add_wait_queue(), which maintains some extra internal state
  552. */
  553. void sbitmap_add_wait_queue(struct sbitmap_queue *sbq,
  554. struct sbq_wait_state *ws,
  555. struct sbq_wait *sbq_wait);
  556. /*
  557. * Must be paired with sbitmap_add_wait_queue()
  558. */
  559. void sbitmap_del_wait_queue(struct sbq_wait *sbq_wait);
  560. #endif /* __LINUX_SCALE_BITMAP_H */