STRUCT SBITMAP_QUEUE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct sbitmap_queue(9) ✨

okay so this is a page from the Kernel API Manual, and bestie, we're about to get into it πŸ’…


πŸŽ€ NAME πŸŽ€

struct sbitmap_queue β€” it's a scalable bitmap, but make it extra: it can also wait on free bits. like, the bitmap version of "bestie hold on, we're full rn" 🫢


🌸 SYNOPSIS 🌸

struct sbitmap_queue {
    struct sbitmap sb;
    unsigned int wake_batch;
    atomic_t wake_index;
    struct sbq_wait_state *ws;
    atomic_t ws_active;
    unsigned int min_shallow_depth;
    atomic_t completion_cnt;
    atomic_t wakeup_cnt;
 };

πŸ¦‹ Members πŸ¦‹

okay let's meet the cast, no skips, all of them get a moment πŸ‘‘

  • sb β€” the scalable bitmap itself. the main character, honestly.
  • wake_batch β€” the number of bits that have to be freed before we wake up any waiters. like a minimum order for the wake-up call fr fr.
  • wake_index β€” the next wait queue in ws that we're gonna wake up. taking turns, being fair, we love to see it ✨
  • ws β€” the wait queues. plural. the whole squad.
  • ws_active β€” a count of the currently active ws waitqueues. lowkey a headcount.
  • min_shallow_depth β€” the minimum shallow depth that may be passed to sbitmap_queue_get_shallow. that's the rule, that's the floor, no going below it πŸ™ˆ
  • completion_cnt β€” number of bits cleared that got passed to the wakeup function.
  • wakeup_cnt β€” number of thread wake ups that got issued. the receipt count, basically 🧾

πŸ’œ Description πŸ’œ

so the whole vibe of a struct sbitmap_queue is: it uses multiple wait queues and rolling wakeups so we don't all pile up on the wait queue spinlock and start fighting. like, no cap, contention is not cute πŸ’€

that way we don't hit a scalability wall when we run out of free bits and have to start putting tasks to sleep. because hitting that wall? it's giving tragedy. we simply don't. ⭐


πŸ”₯ SEE ALSO πŸ”₯

kernel file ./include/linux/sbitmap.h, plus the whole friend group:


and that's the whole page, bestie 🫢 go forth and be scalable.

sign-off szn πŸ’– this one came straight out of ./include/linux, dated October 2026, and yes it's struct sbitmap_queue(9) β€” mwah, iconic, periodt πŸ’…πŸŽ€

πŸ“¦ where this page comes from