STRUCT OBJPOOL_SLOT(9)
π NAME π
okay so bestie, this page is struct objpool_slot(9) from the Kernel API Manual, and it is literally the percpu ring array of objpool. iconic little data structure, no cap. π
β¨ SYNOPSIS β¨
here's the exact shape, don't touch the punctuation:
struct objpool_slot {
uint32_t head;
uint32_t tail;
uint32_t last;
uint32_t mask;
void *entries[];
};
π Members π
headβ head sequence of the local ring array (to retrieve at) πtailβ tail sequence of the local ring array (to append at) β¨lastβ the last sequence number marked as ready for retrieve πmaskβ bits mask for modulo capacity to compute array indexes π§entriesβ object entries on this slot π
πΈ Description πΈ
okay so this thing represents a cpu-local array-based ring buffer, and its size is specialized during initialization of object pool. The percpu objpool node is to be allocated from local memory for NUMA system, and to be kept compact in continuous memory: CPU assigned number of objects are stored just after the body of objpool_node. that's the whole vibe: compact, local, and not wasting space. π«Ά
and here's the part that makes it click: the real size of the ring array is far too smaller than the value range of head and tail, typed as uint32_t: [0, 2^32), so only lower bits (mask) of head and tail are used as the actual position in the ring array. in general the ring array is acting like a small sliding window, which is always moving forward in the loop of [0, 2^32). literally a tiny window sliding forever, lowkey obsessed. π«
π₯ SEE ALSO π₯
- Kernel file
./include/linux/objpool.hπ struct objpool_head(9)objpool_init(9)objpool_pop(9)objpool_push(9)objpool_drop(9)objpool_free(9)objpool_fini(9)
that's the whole page, bestie β source ./include/linux, dated October 2026, page struct objpool_slot(9) π«Άπ
π¦ 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