STRUCT SBITMAP_QUEUE(9)
β¨ 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 inwsthat 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 activewswaitqueues. lowkey a headcount.min_shallow_depthβ the minimum shallow depth that may be passed tosbitmap_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:
struct sbitmap_word(9)struct sbitmap(9)struct sbq_wait_state(9)sbitmap_init_node(9)sbitmap_free(9)sbitmap_resize(9)sbitmap_get(9)sbitmap_any_bit_set(9)__sbitmap_for_each_set(9)sbitmap_for_each_set(9)sbitmap_show(9)sbitmap_weight(9)sbitmap_bitmap_show(9)sbitmap_queue_init_node(9)sbitmap_queue_free(9)sbitmap_queue_recalculate_wake_batch(9)sbitmap_queue_resize(9)__sbitmap_queue_get(9)__sbitmap_queue_get_batch(9)sbitmap_queue_get_shallow(9)sbitmap_queue_get(9)sbitmap_queue_min_shallow_depth(9)sbitmap_queue_clear(9)sbitmap_queue_clear_batch(9)sbq_wait_ptr(9)sbitmap_queue_wake_all(9)sbitmap_queue_wake_up(9)sbitmap_queue_show(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms